// https://www.reddit.com/r/FastLED/comments/pn9zi9/fadetoblackby_question/
#include <FastLED.h>
#define NUM_LEDS_PER_STRIP 256
CRGB leds_1[NUM_LEDS_PER_STRIP];
CRGB leds_2[NUM_LEDS_PER_STRIP];
void setup() {
Serial.begin(115200);
FastLED.addLeds<NEOPIXEL, 5>(leds_1, NUM_LEDS_PER_STRIP);
FastLED.addLeds<NEOPIXEL, 6>(leds_2, NUM_LEDS_PER_STRIP);
}
void loop() {
CRGB colOrig = CRGB(255, 128, 64);
CRGB colFade = colOrig;
for (int fade = 0; fade <= 255; fade++) {
// fade the original colour by an increasing amount
leds_1[fade] = colOrig;
leds_1[fade].fadeToBlackBy(fade);
// fade a colour iteratively
leds_2[fade] = colFade;
colFade.fadeToBlackBy(1);
// show the RGB values for each style
Serial.print(leds_1[fade].r); Serial.print(", ");
Serial.print(leds_1[fade].g); Serial.print(", ");
Serial.print(leds_1[fade].b);
Serial.print(" \t");
Serial.print(leds_2[fade].r); Serial.print(", ");
Serial.print(leds_2[fade].g); Serial.print(", ");
Serial.println(leds_2[fade].b);
}
FastLED.show();
while (1) {}
}