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.

ArrayOfLedArrays.ino 1.3KB

3 years ago
12345678910111213141516171819202122232425262728293031323334353637
  1. // ArrayOfLedArrays - 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, only this time they're going
  4. // to be all parts of an array of arrays.
  5. #include <FastLED.h>
  6. #define NUM_STRIPS 3
  7. #define NUM_LEDS_PER_STRIP 60
  8. CRGB leds[NUM_STRIPS][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>(leds[0], NUM_LEDS_PER_STRIP);
  14. // tell FastLED there's 60 NEOPIXEL leds on pin 11
  15. FastLED.addLeds<NEOPIXEL, 11>(leds[1], NUM_LEDS_PER_STRIP);
  16. // tell FastLED there's 60 NEOPIXEL leds on pin 12
  17. FastLED.addLeds<NEOPIXEL, 12>(leds[2], NUM_LEDS_PER_STRIP);
  18. }
  19. void loop() {
  20. // This outer loop will go over each strip, one at a time
  21. for(int x = 0; x < NUM_STRIPS; x++) {
  22. // This inner loop will go over each led in the current strip, one at a time
  23. for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) {
  24. leds[x][i] = CRGB::Red;
  25. FastLED.show();
  26. leds[x][i] = CRGB::Black;
  27. delay(100);
  28. }
  29. }
  30. }