I added in a second loop that fades down redHere is the initial 0-255 rainbow. i I dunno if this is what you are trying to achieve but @bigjoshi took initiative from @bigjosh's answer. This just cycles thru each rgb from 0-255. @bigjosh does fade upstart red, but does not fade it down at 0-255 allowing for more for red colors. so here ya go:
void loop(){
//start from red
for( int colorStep=0; colorStep <= 255; colorStep++ ) {
int r = 255;
int g = 0;
int b = colorStep;
// RednessNow startsloop atthough zeroeach of the LEDs and goesset upeach one to fullthe current color
for(int x = 0; x < LED_COUNT; x++){
leds[x] = CRGB(r,g,b);
}
// Display the colors we just set on the actual LEDs
delay(10);
FastLED.show();
}
//into blue
for( int colorStep=255; colorStep >= 0; colorStep-- ) {
int r = colorStep;
int g = 0;
int b = 255;
// BlueNow startsloop atthough fulleach of the LEDs and goesset downeach one to zerothe current color
for(int gx = 0; x < LED_COUNT; x++){
leds[x] = CRGB(r,g,b);
}
// NoDisplay greenthe neededcolors towe gojust set on the actual LEDs
delay(10);
FastLED.show();
}
//start from blue
to redfor( int colorStep=0; colorStep <= 255; colorStep++ ) {
int r = 0;
int g = colorStep;
int b = 255;
// Now loop though each of the LEDs and set each one to the current color
for(int x = 0; x < LED_COUNT; x++){
leds[x] = CRGB(r,g,b);
}
// Display the colors we just set on the actual LEDs
delay(10);
FastLED.show();
}
//into green
for( int colorStep=255; colorStep >= 0; colorStep-- ) {
int r = 0;
int g = 255;
int b = colorStep;
// RednessNow startsloop atthough zeroeach of the LEDs and goesset upeach one to fullthe current color
for(int x = 0; x < LED_COUNT; x++){
leds[x] = CRGB(r,g,b);
}
// Display the colors we just set on the actual LEDs
delay(wait_time);
LEDS.show();
}
//start from green
for( int colorStep=0; colorStep <= 255; colorStep++ ) {
int r = colorStep;
int g = 255;
int b = 0;
// BlueNow startsloop atthough fulleach of the LEDs and goesset downeach one to zerothe current color
for(int gx = 0; x < LED_COUNT; x++){
leds[x] = CRGB(r,g,b);
}
// NoDisplay greenthe neededcolors towe gojust fromset blueon tothe redactual LEDs
delay(wait_time);
LEDS.show();
}
//into yellow
for( int colorStep=255; colorStep >= 0; colorStep-- ) {
int r = 255;
int g = colorStep;
int b = 0;
// Now loop though each of the LEDs and set each one to the current color
for(int x = 0; x < LED_COUNT; x++){
leds[x] = CRGB(r,g,b);
}
// Display the colors we just set on the actual LEDs
delay(10wait_time);
FastLEDLEDS.show();
}
} //end main loop
more documentation on the subject can be found: https://www.arduino.cc/en/tutorial/fading