I’m trying to reverse engineer some FastLED code 1) so I don’t have to ask as many questions and tie up everyone’s time, and 2) so I learn some code. Once again though, I’m at the office without a strip, trying to make productive use of my coffee break. So quick question…
if i =5 and j = 7 and you have…
leds[i+j] = CRGB::Red;
Will leds 5 and 7 both light up, or just led 12?
Thanks!
(If I get off work and to my leds before I get an answer, I’ll post my own answer for anyone else’s future reference.)
Two separate lines as Mike wrote is probably the most clear as to what is going on, but this would also light both 5 and 7.
leds[i] = leds[j] = CRGB::Red;
//both pixels light red
And yet another alternative could be:
leds[i] = CRGB::Red;
leds[j] = leds[i];
//both pixels light red
Can be good to see other options to help understand someone else’s code.