#include <FastLED.h>
#define LED_PIN 2
#define NUM_LEDS 12
#define BRIGHTNESS 50
CRGB leds[NUM_LEDS];
DEFINE_GRADIENT_PALETTE(SunsetPal) {
0, 120, 0, 0,
22, 179, 22, 0,
51, 255,104, 0,
85, 167, 22, 18,
135, 100, 0,103,
198, 16, 0,130,
255, 0, 0,160};
CRGBPalette16 Sunset = SunsetPal;
float progress = 0;
void setup() {
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
Serial.begin(9600);
}
void loop() {
uint8_t colorIndex = (progress * 255);
CRGB currentcolor = ColorFromPalette(Sunset, colorIndex);
increaseprogress();
fill_solid(leds, NUM_LEDS, currentcolor);
Serial.println(colorIndex);
FastLED.show();
}
void increaseprogress() {
progress += 0.01;
if (progress > 1.0) {
progress = 1.0;
}
delay(100);
}