//*****https://wokwi.com/projects/390276719337137153
#include <FastLED.h>
// Define the number of LEDs and the data pin
#define NUM_LEDS 6
#define DATA_PIN 9 // Change this to the pin connected to the data input of your WS2812 strip
// Define the colors
#define RED_COLOR CRGB(9, 134, 183)
// Create an array of CRGB objects to represent the LEDs
CRGB leds[NUM_LEDS];
void setup() {
// Uncomment the following line if you want to set up serial communication for debugging
// Serial.begin(9600);
// Initialize FastLED library
FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, NUM_LEDS); //*************************
}
void loop() {
// Loop through each LED, turning it on red
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = RED_COLOR;
// Add a trail effect for the 5 LEDs behind the current one
for (int j = 1; j <= 5 && i - j >= 0; j++) {
leds[i - j] = leds[i - j].fadeToBlackBy(64); // Adjust brightness for the trail effect
}
FastLED.show();
delay(200);
// Turn off the current LED and the trailing LEDs
leds[i] = CRGB::Black;
for (int j = 1; j <= 5 && i - j >= 0; j++) {
leds[i - j] = CRGB::Black;
}
}
}