PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Blink.ino 3.6KB

3 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #include <FastLED.h>
  2. // How many leds in your strip?
  3. #define NUM_LEDS 1
  4. // For led chips like WS2812, which have a data line, ground, and power, you just
  5. // need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
  6. // ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
  7. // Clock pin only needed for SPI based chipsets when not using hardware SPI
  8. #define DATA_PIN 3
  9. #define CLOCK_PIN 13
  10. // Define the array of leds
  11. CRGB leds[NUM_LEDS];
  12. void setup() {
  13. // Uncomment/edit one of the following lines for your leds arrangement.
  14. // ## Clockless types ##
  15. FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // GRB ordering is assumed
  16. // FastLED.addLeds<SM16703, DATA_PIN, RGB>(leds, NUM_LEDS);
  17. // FastLED.addLeds<TM1829, DATA_PIN, RGB>(leds, NUM_LEDS);
  18. // FastLED.addLeds<TM1812, DATA_PIN, RGB>(leds, NUM_LEDS);
  19. // FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
  20. // FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
  21. // FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
  22. // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
  23. // FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS);
  24. // FastLED.addLeds<UCS1904, DATA_PIN, RGB>(leds, NUM_LEDS);
  25. // FastLED.addLeds<UCS2903, DATA_PIN, RGB>(leds, NUM_LEDS);
  26. // FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
  27. // FastLED.addLeds<WS2852, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
  28. // FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
  29. // FastLED.addLeds<GS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
  30. // FastLED.addLeds<SK6812, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
  31. // FastLED.addLeds<SK6822, DATA_PIN, RGB>(leds, NUM_LEDS);
  32. // FastLED.addLeds<APA106, DATA_PIN, RGB>(leds, NUM_LEDS);
  33. // FastLED.addLeds<PL9823, DATA_PIN, RGB>(leds, NUM_LEDS);
  34. // FastLED.addLeds<SK6822, DATA_PIN, RGB>(leds, NUM_LEDS);
  35. // FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
  36. // FastLED.addLeds<WS2813, DATA_PIN, RGB>(leds, NUM_LEDS);
  37. // FastLED.addLeds<APA104, DATA_PIN, RGB>(leds, NUM_LEDS);
  38. // FastLED.addLeds<WS2811_400, DATA_PIN, RGB>(leds, NUM_LEDS);
  39. // FastLED.addLeds<GE8822, DATA_PIN, RGB>(leds, NUM_LEDS);
  40. // FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS);
  41. // FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS);
  42. // FastLED.addLeds<LPD1886, DATA_PIN, RGB>(leds, NUM_LEDS);
  43. // FastLED.addLeds<LPD1886_8BIT, DATA_PIN, RGB>(leds, NUM_LEDS);
  44. // ## Clocked (SPI) types ##
  45. // FastLED.addLeds<LPD6803, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
  46. // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
  47. // FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
  48. // FastLED.addLeds<WS2803, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
  49. // FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
  50. // FastLED.addLeds<P9813, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
  51. // FastLED.addLeds<DOTSTAR, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
  52. // FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
  53. // FastLED.addLeds<SK9822, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
  54. }
  55. void loop() {
  56. // Turn the LED on, then pause
  57. leds[0] = CRGB::Red;
  58. FastLED.show();
  59. delay(500);
  60. // Now turn the LED off, then pause
  61. leds[0] = CRGB::Black;
  62. FastLED.show();
  63. delay(500);
  64. }