#include <Adafruit_NeoPixel.h>
#define LED_PIN 6
#define NUM_LEDS 30
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
strip.fill(strip.Color(0, 0, 0), 0, NUM_LEDS); // Alle LEDs auf Schwarz setzen
strip.show();
strip.setBrightness(200);
}
void loop() {
rainbowCycle(5);
}
void rainbowCycle(uint8_t wait) {
for (int j = 0; j < 256; j++) {
for (int i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel((i + j) & 255));
}
strip.show();
delay(wait);
}
}
uint32_t Wheel(byte WheelPos) {
WheelPos = 255 - WheelPos;
if (WheelPos < 85) {
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
}
if (WheelPos < 170) {
WheelPos -= 85;
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
WheelPos -= 170;
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}