int color_set = 0; //set to red first // set the color for all the LEDs based on the color code void setcolor(int colorcode) { for (int i = 0; i < LED_COUNT; i++) { // instead of setting the color all at once we're going to step through each LED to show how to set them individually switch(colorcode) { // We're going to pass a CRGB here, case 0: leds[i] = CRGB(255, 0 , 0); break; // red case 1: leds[i] = CRGB(255, 127, 0); break; // orange case 2: leds[i] = CRGB(255, 255, 0); break; // yellow case 3: leds[i] = CRGB(0, 255, 0); break; // green case 4: leds[i] = CRGB(0, 255, 255); break; // cyan case 5: leds[i] = CRGB(0, 0, 255); break; // blue case 6: leds[i] = CRGB(75, 0, 130); break; // indigo case 7: leds[i] = CRGB(148, 0, 211); break; // violet } } LEDS.show(); } // we'll make the color fade in and out by setting the brightness void pulse(int wait_fade) { // let's fade up by scaling the brightness - in general, brightness shouldn't go above 93, so the strip won't draw too much power. // Oh, and 93 is plenty bright! for(int scale = 0; scale < 93; scale++) { LEDS.setBrightness(scale); LEDS.show(); delay(wait_fade); } // now let's fade down by scaling the brightness for(int scale = 93; scale > 0; scale--) { LEDS.setBrightness(scale); LEDS.show(); delay(wait_fade); } } // this is the main loop where we call the other functions. void loop() { int waiting_time = 10; //time in ms for color scaling setcolor(color_set); //we call our color-set routine pulse(waiting_time); //now we make it fade in and out color_set++; //next color color_set = color_set % 8; // number of color modulus, remember it's 0 based. }