#include <FastLED.h>
#define LED_PIN 1 // Pin to which the LED strip is connected (change as needed)
#define NUM_LEDS 20 // Number of LEDs in your strip (change as needed)
#define BRIGHTNESS 150 // Set the brightness of the LEDs (0-255)
// Define your custom colors here (add or remove as needed)
CRGB colors[] = {
CRGB(25, 200, 200),
CRGB(25, 100, 200),
CRGB(100, 10, 30),
CRGB(250,165,0)
};
// Calculate the number of colors in the array
#define NUM_COLORS (sizeof(colors) / sizeof(colors[0]))
// Declare the LED array
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
}
void loop() {
// Change the delay value to adjust the speed of the gradient
gradientEffect(50);
}
void gradientEffect(int delayTime) {
static int colorIndex = 0;
// Calculate the indices of the current and next colors
int currentColorIndex = colorIndex % NUM_COLORS;
int nextColorIndex = (colorIndex + 1) % NUM_COLORS;
// Linear interpolation between the current and next colors
for (int i = 0; i <= 255; i++) {
for (int j = 0; j < NUM_LEDS; j++) {
leds[j] = blend(colors[currentColorIndex], colors[nextColorIndex], i);
}
FastLED.show();
delay(delayTime);
}
// Increment the color index for the next iteration
colorIndex++;
// Reset color index when it exceeds the number of colors
if (colorIndex == NUM_COLORS) {
colorIndex = 0;
}
}
FPS: 0
Power: 0.00W
Power: 0.00W