0
votes

Please be patient with me as I'm still new to coding using the FASTLED Library. I'm using a teensy 3.2 with the fastled library. I have a strip of 144LED of WS2812B and I'm trying to create a color hue consisting of 3 colors( i want the first quarter of the strip to (48LEDS) to be pink then the next 48 orange and the last set of 48 Blue. I know to write to each LED by using the following

leds[0] = CRGB::Red;
FastLED.show();
delay(500);
leds[1] = CRGB::Red;
FastLED.show();
delay(500);
leds[2] = CRGB::Red;
FastLED.show();
delay(500);

etc..

But this is tedious to do for each LED as for the final build I have close to 1000 LEDs. is there a way to enter a range of leds such as

leds[0-48] = CRGB::Red;
FastLED.show();
delay(500);

or something like similar I'm having issues compiling using the above code or a few ways I have tried

Any help is greatly appreciated !! Thanks in advance.

1

1 Answers

0
votes

try something like this

CRGB colors[3] = {CRGB::Red, CRGB::Blue, CRGB::Green}; // Array of colors
for (int i=0; i <NUM_LEDS; i++){
   leds[i] = colors[i%48]; // Divide the colors array into three segments
}
FastLED.show();
delay(500);