how would i set a CRGB set of specific led address’s…
for example.
i can set 0, i can set 0-100, i can start at 10 and go to 20.
but how can i set 1, 4, 5, 7, 9… non calculating but specific leds in 1 array?
how would i set a CRGB set of specific led address’s…
for example.
i can set 0, i can set 0-100, i can start at 10 and go to 20.
but how can i set 1, 4, 5, 7, 9… non calculating but specific leds in 1 array?
To do something like this, I use an LED lookup table. It can be an expensive thing to do when you are using a lot of LEDs with an Arduino, but if you are using a teensy 3.2, which I prefer, you should be fine.
Please excuse my poor typing as I am completing this from my phone.
A lookup table looks like this:
uint8_t LED_lookupTable_length = 5;
uint8_t LED_lookupTable[] = { 1, 4, 5, 7, 9};
Then to run through it, use a for loop and use the values in the table to target the corresponding LEDs:
for( int LED = 0; LED < LED_lookupTable_length; LED++){
int pos = LED_lookupTable[LED];
leds[pos] = CRGB(255, 0, 0);
}
nt pos = LED_lookupTable[LED]; that’s the bit of code I’m looking for!! Thanks!
Annoyingly I was so close! I have the lookup table already made and the figures in, was just trying to directly correlate the Int=[] to the crgb=…!