#include <FastLED.h>
#define LED_PIN 5 // Replace with the pin number you used for DATA connection
#define NUM_LEDS 50 // Replace with the number of LEDs in your strip
#define DELAY_TIME 50 // Delay between LED movements (in milliseconds)
CRGB leds[NUM_LEDS];
uint8_t hue = 0;
void setup() {
FastLED.addLeds<WS2811, LED_PIN, RGB>(leds, NUM_LEDS);
}
void loop() {
//p_1();
p_2();
}
void p_1() {
// Turn off all LEDs
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(253, 4, 4);
}
// Move the LED chaser
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(0, 0, 249); // Set the current LED to blue
FastLED.show(); // Update the LED strip
delay(DELAY_TIME); // Delay between LED movements
}
// Move the LED chaser in reverse
for (int i = NUM_LEDS - 1; i >= 0; i--) {
leds[i] = CRGB::Green; // Set the current LED to green
FastLED.show(); // Update the LED strip
delay(DELAY_TIME); // Delay between LED movements
}
}
void p_2() {
for (int i = 0; i < NUM_LEDS; i++) {
//leds[i] = CHSV(hue, 255, 255);
leds[i] = CHSV(hue + (i * 10), 255, 255);
}
EVERY_N_MILLISECONDS(15){
hue++;
}
FastLED.show();
}