PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

93 行
4.7KB

  1. // Use if you want to force the software SPI subsystem to be used for some reason (generally, you don't)
  2. // #define FASTLED_FORCE_SOFTWARE_SPI
  3. // Use if you want to force non-accelerated pin access (hint: you really don't, it breaks lots of things)
  4. // #define FASTLED_FORCE_SOFTWARE_SPI
  5. // #define FASTLED_FORCE_SOFTWARE_PINS
  6. #include <FastLED.h>
  7. ///////////////////////////////////////////////////////////////////////////////////////////
  8. //
  9. // Move a white dot along the strip of leds. This program simply shows how to configure the leds,
  10. // and then how to turn a single pixel white and then off, moving down the line of pixels.
  11. //
  12. // How many leds are in the strip?
  13. #define NUM_LEDS 60
  14. // For led chips like WS2812, which have a data line, ground, and power, you just
  15. // need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
  16. // ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
  17. // Clock pin only needed for SPI based chipsets when not using hardware SPI
  18. #define DATA_PIN 3
  19. #define CLOCK_PIN 13
  20. // This is an array of leds. One item for each led in your strip.
  21. CRGB leds[NUM_LEDS];
  22. // This function sets up the ledsand tells the controller about them
  23. void setup() {
  24. // sanity check delay - allows reprogramming if accidently blowing power w/leds
  25. delay(2000);
  26. // Uncomment/edit one of the following lines for your leds arrangement.
  27. // ## Clockless types ##
  28. // FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // GRB ordering is assumed
  29. // FastLED.addLeds<SM16703, DATA_PIN, RGB>(leds, NUM_LEDS);
  30. // FastLED.addLeds<TM1829, DATA_PIN, RGB>(leds, NUM_LEDS);
  31. // FastLED.addLeds<TM1812, DATA_PIN, RGB>(leds, NUM_LEDS);
  32. // FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
  33. // FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
  34. // FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
  35. // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
  36. // FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS);
  37. // FastLED.addLeds<UCS1904, DATA_PIN, RGB>(leds, NUM_LEDS);
  38. // FastLED.addLeds<UCS2903, DATA_PIN, RGB>(leds, NUM_LEDS);
  39. // FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
  40. // FastLED.addLeds<WS2852, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
  41. // FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
  42. // FastLED.addLeds<GS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
  43. // FastLED.addLeds<SK6812, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
  44. // FastLED.addLeds<SK6822, DATA_PIN, RGB>(leds, NUM_LEDS);
  45. // FastLED.addLeds<APA106, DATA_PIN, RGB>(leds, NUM_LEDS);
  46. // FastLED.addLeds<PL9823, DATA_PIN, RGB>(leds, NUM_LEDS);
  47. // FastLED.addLeds<SK6822, DATA_PIN, RGB>(leds, NUM_LEDS);
  48. FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
  49. // FastLED.addLeds<WS2813, DATA_PIN, RGB>(leds, NUM_LEDS);
  50. // FastLED.addLeds<APA104, DATA_PIN, RGB>(leds, NUM_LEDS);
  51. // FastLED.addLeds<WS2811_400, DATA_PIN, RGB>(leds, NUM_LEDS);
  52. // FastLED.addLeds<GE8822, DATA_PIN, RGB>(leds, NUM_LEDS);
  53. // FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS);
  54. // FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS);
  55. // FastLED.addLeds<LPD1886, DATA_PIN, RGB>(leds, NUM_LEDS);
  56. // FastLED.addLeds<LPD1886_8BIT, DATA_PIN, RGB>(leds, NUM_LEDS);
  57. // ## Clocked (SPI) types ##
  58. // FastLED.addLeds<LPD6803, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
  59. // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
  60. // FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
  61. // FastLED.addLeds<WS2803, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
  62. // FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
  63. // FastLED.addLeds<P9813, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
  64. // FastLED.addLeds<DOTSTAR, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
  65. // FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
  66. // FastLED.addLeds<SK9822, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
  67. }
  68. // This function runs over and over, and is where you do the magic to light
  69. // your leds.
  70. void loop() {
  71. // Move a single white led
  72. for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1) {
  73. // Turn our current led on to white, then show the leds
  74. leds[whiteLed] = CRGB::White;
  75. // Show the leds (only one of which is set to white, from above)
  76. FastLED.show();
  77. // Wait a little bit
  78. delay(100);
  79. // Turn our current led back to black for the next loop around
  80. leds[whiteLed] = CRGB::Black;
  81. }
  82. }