#include <FastLED.h>
#define LED_PIN 7
#define NUM_LEDS 144
#define BRIGHTNESS 100
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
uint8_t hue = 0; // Keep hue as uint8_t
void setup() {
delay(1000); // Power-up safety delay
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(BRIGHTNESS);
}
void loop() {
rainbow();
// Show the LEDs
FastLED.show();
// Change the hue for the next loop iteration
hue = hue + 2.5;
// Wait a bit before moving on to the next frame
FastLED.delay(20);
}
void rainbow() {
// Calculate the hue delta to spread the colors across the entire strip
uint8_t deltaHue = 256 / NUM_LEDS + 1;
for(int i = 0; i < NUM_LEDS; i++) {
// Apply the hue offset for each LED to create a smooth gradient
leds[i] = CHSV(hue + (deltaHue * i), 255, 255);
}
}