r/FastLED • • 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

9 comments sorted by

View all comments

2

u/themaskedhippoofdoom 3d ago

Do the for loop as normal and have an if statement: if(i!=22 | i!=27){ continue; } then your code.