#include <Adafruit_NeoPixel.h>
#define LED_PIN 6
#define LED_COUNT 16
Adafruit_NeoPixel ring(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup()
{
ring.begin();
ring.show();
ring.setBrightness(255);
}
void loop()
{
colorWipe(ring.Color(255, 0, 0), 50); // Rot
colorWipe(ring.Color( 0, 255, 0), 50); // Grün
colorWipe(ring.Color( 0, 0, 255), 50); // Blau
/* theaterChase(ring.Color(255, 255, 255), 50); // Weiß, halbe Helligkeit
theaterChase(ring.Color(255, 0, 0), 50); // Rot, halbe Helligkeit
theaterChase(ring.Color( 0, 0, 255), 50); // Blau, halbe Helligkeit
rainbow(10); // Fließender Regenbogenzyklus entlang des gesamten Rings theaterChaseRainbow(50);
// Regenbogen-verstärktetheaterChase-Variante
*/
// delay(1000);
}
void colorWipe(uint32_t color, int wait)
{ for(int i=0; i<ring.numPixels(); i++)
{
ring.setPixelColor(i, color);
ring.show();
delay(1000);
}
}
/*
void theaterChase(uint32_t color, int wait)
{
for(int a=0; a<10; a++)
{
for(int b=0; b<3; b++)
{
ring.clear();
for(int c=b; c<ring.numPixels(); c += 3)
{
ring.setPixelColor(c, color); // Pixel 'c' auf Wert 'color' setzen
}
ring.show();
delay(wait);
}
}
}
void rainbow(int wait)
{
for(long firstPixelHue = 0; firstPixelHue < 5*65536; firstPixelHue += 256)
{
for(int i=0; i<ring.numPixels(); i++)
{
int pixelHue = firstPixelHue + (i * 65536L / ring.numPixels());
ring.setPixelColor(i, ring.gamma32(ring.ColorHSV(pixelHue)));
}
ring.show();
delay(wait);
}
}
void theaterChaseRainbow(int wait)
{
int firstPixelHue = 0; // Das erste Pixel beginnt bei Rot (Farbton 0)
for(int a=0; a<30; a++)
{
for(int b=0; b<3; b++)
{
ring.clear();
for(int c=b; c<ring.numPixels(); c += 3)
{
int hue = firstPixelHue + c * 65536L / ring.numPixels();
uint32_t color = ring.gamma32(ring.ColorHSV(hue));
ring.setPixelColor(c, color);
}
ring.show();
delay(wait);
firstPixelHue += 65536 / 90;
}
}
}
*/