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.

MultipleStripsInOneArray.ino 1.2KB

3 years ago
12345678910111213141516171819202122232425262728293031323334
  1. // MultipleStripsInOneArray - 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 four NEOPIXEL strips on three
  3. // different pins, each strip will be referring to a different part of the single led array
  4. #include <FastLED.h>
  5. #define NUM_STRIPS 3
  6. #define NUM_LEDS_PER_STRIP 60
  7. #define NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS
  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, starting at index 0 in the led array
  13. FastLED.addLeds<NEOPIXEL, 10>(leds, 0, NUM_LEDS_PER_STRIP);
  14. // tell FastLED there's 60 NEOPIXEL leds on pin 11, starting at index 60 in the led array
  15. FastLED.addLeds<NEOPIXEL, 11>(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
  16. // tell FastLED there's 60 NEOPIXEL leds on pin 12, starting at index 120 in the led array
  17. FastLED.addLeds<NEOPIXEL, 12>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
  18. }
  19. void loop() {
  20. for(int i = 0; i < NUM_LEDS; i++) {
  21. leds[i] = CRGB::Red;
  22. FastLED.show();
  23. leds[i] = CRGB::Black;
  24. delay(100);
  25. }
  26. }