I’ve been working with the NeoPixels for years, and am just now getting into the FastLED library.
I’m building a simple blinky, with 4 buttons and 4 LEDs. If you press button 1, LED 1 lights up red… button 2, LED 2 lights up green… 3 is blue and 4 is yellow. If the buttons, LEDs, and color assignments are each an array, I should be able to have a super simple for loop to run it all (right?).
My arrays are:
CRGB leds[4];
uint8_t button[] = {10, 11, 12, 13}; //button pins
So, I’d like to do something like this:
colorVar[] = {“Red”, “Green”, “Blue”, “Yellow”};
There isn’t a variable type that can do this, right? Right now I have 3 more arrays, for red, green, and blue:
uint8_t red[] = {255, 0, 0, 255};
uint8_t green[] = {0, 255, 0, 255};
uint8_t blue[] = {0, 0, 255, 0};
and am setting the LEDs in the for loop like this:
leds[i].setRGB(red[i], green[i], blue[i]);
But I’d really like to have a single value, to do something like this:
leds[i] = CRGB::colorVar[i];
or
leds[i].setRGB(colorVar[i]);
I’d be happy using a single integer or web code (0xFF0000) if the words can’t be stored as variables, but not sure how. Can it be done simply?
THANK YOU