Hi I want to do a simple thing:

Hi
I want to do a simple thing:
Change all leds to a single color when I press a push button.
I stored all possible colors in an array and when I press up, I go to the following color, and down to the previous color.

I use the function fill_solid but I’m struggling with
fill_solid(leds, NUM_LEDS, CRGB::Red);
Can I just replace “CRGB::Red” by my array value ? for example color(i) with I integer pointing to a color in table color?

http://pastebin.com/mc1cg325

Thank you for your help

Hi! You cannot use the FastLED string names in your code as strings. You need to change your “couleurs” array to be of type CRGB, with the elements being the CRGB types. And then access them with “couleurs[]”. Something like this:

CRGB couleurs[3] = {
CRGB::AliceBlue,
CRGB::Amethyst,
CRGB::AntiqueWhite
};

void loop() {
for( int i=0; i< 3; i++ ) {
CRGB c = couleurs[i];
fill_solid(leds, NUM_LEDS, c);
FastLED.show();
delay(1000;
}
}