#include <FastLED.h>
#define LED_PIN 5 // Replace with the pin number you used for DATA connection
#define NUM_LEDS 20 // Replace with the number of LEDs in your strip
#define FLICKER_DELAY 20 // Delay between flicker changes (in milliseconds)
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2811, LED_PIN, RGB>(leds, NUM_LEDS);
}
void loop() {
// Set the initial color for the candle flame
CRGB flameColor = CRGB::Red;
// Create a flickering effect
for (int i = 0; i < NUM_LEDS; i++) {
// Randomly flicker the LEDs
if (random(10) < 5) {
leds[i] = flameColor;
} else {
leds[i] = CRGB::Black;
}
}
FastLED.show(); // Update the LED strip
delay(FLICKER_DELAY); // Delay between flicker changes
}