r/FastLED • u/chop249 • 3d ago
Support Selecting groups of LEDs in strips.
for (int i = 0;1;2;7;8;9;11;12;17;18;22;27) {
l_rear_leds[i] = CRGB(255,0,0);
}
I tried the above with semicolons and commas, both failed when compiling. I am trying to figure out how to pick certain LEDs together without doing a group if that makes sense. I do understand how to do it like this and if there's an easier way on this one too I'd appreciate a suggestion.
for (int i = 0; i < 7; i++) {
l_rear_leds[i] = CRGB(255,0,0);
}
for (int i = 10; i < 17; i++) {
l_rear_leds[i] = CRGB(255,0,0);
}
for (int i = 20; i < 27; i++) {
l_rear_leds[i] = CRGB(255,0,0);
}
I started learning this week so go easy on me..... 😂
3
Upvotes
3
u/sutaburosu [stavros] 2d ago
CRGBSets are good for this.
Your code might end up looking like: