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.

53 lines
1.7KB

  1. // MultiArrays - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on
  2. // using multiple controllers. In this example, we're going to set up three NEOPIXEL strips on three
  3. // different pins, each strip getting its own CRGB array to be played with
  4. #include <FastLED.h>
  5. #define NUM_LEDS_PER_STRIP 60
  6. CRGB redLeds[NUM_LEDS_PER_STRIP];
  7. CRGB greenLeds[NUM_LEDS_PER_STRIP];
  8. CRGB blueLeds[NUM_LEDS_PER_STRIP];
  9. // For mirroring strips, all the "special" stuff happens just in setup. We
  10. // just addLeds multiple times, once for each strip
  11. void setup() {
  12. // tell FastLED there's 60 NEOPIXEL leds on pin 10
  13. FastLED.addLeds<NEOPIXEL, 10>(redLeds, NUM_LEDS_PER_STRIP);
  14. // tell FastLED there's 60 NEOPIXEL leds on pin 11
  15. FastLED.addLeds<NEOPIXEL, 11>(greenLeds, NUM_LEDS_PER_STRIP);
  16. // tell FastLED there's 60 NEOPIXEL leds on pin 12
  17. FastLED.addLeds<NEOPIXEL, 12>(blueLeds, NUM_LEDS_PER_STRIP);
  18. }
  19. void loop() {
  20. for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) {
  21. // set our current dot to red, green, and blue
  22. redLeds[i] = CRGB::Red;
  23. greenLeds[i] = CRGB::Green;
  24. blueLeds[i] = CRGB::Blue;
  25. FastLED.show();
  26. // clear our current dot before we move on
  27. redLeds[i] = CRGB::Black;
  28. greenLeds[i] = CRGB::Black;
  29. blueLeds[i] = CRGB::Black;
  30. delay(100);
  31. }
  32. for(int i = NUM_LEDS_PER_STRIP-1; i >= 0; i--) {
  33. // set our current dot to red, green, and blue
  34. redLeds[i] = CRGB::Red;
  35. greenLeds[i] = CRGB::Green;
  36. blueLeds[i] = CRGB::Blue;
  37. FastLED.show();
  38. // clear our current dot before we move on
  39. redLeds[i] = CRGB::Black;
  40. greenLeds[i] = CRGB::Black;
  41. blueLeds[i] = CRGB::Black;
  42. delay(100);
  43. }
  44. }