// testet ob der LED Streifen auch funktioniert.
#include <Arduino.h>
#include <FastLED.h>
// How many leds in your strip?
#define NUM_LEDS 23
#define DATA_PIN 4
// Define the array of leds
CRGB leds[NUM_LEDS];
#define NUM_COLORS 5
static const CRGB TwinkleColors [NUM_COLORS] =
{
CRGB::Red,
CRGB::Blue,
CRGB::Purple,
CRGB::Green,
CRGB::Yellow
};
int g_Brightness = 255;
void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // GRB ordering is assumed
}
void DrawKitt()
{
static int iDirection = 1;
static int iPos = 0;
iPos += iDirection;
if (iPos == (NUM_LEDS - 1) || iPos == 0)
iDirection *= -1;
FastLED.clear();
leds[iPos].setHue(HUE_RED);
if( (iPos+1)< NUM_LEDS )
leds[iPos+1].setHue(HUE_RED).fadeToBlackBy(100);
leds[iPos-1].setHue(HUE_RED).fadeToBlackBy(100);
delay(150);
}
void DrawTwinkle()
{
FastLED.clear(false);
for (int i=0; i<NUM_LEDS/4; i++)
{
leds[random(NUM_LEDS)] = TwinkleColors[random(0, NUM_COLORS)];
FastLED.show(g_Brightness);
delay(200);
}
}
void DrawMarqueeMirrored()
{
static byte j = 0;
j+=4;
byte k = j;
// Roughly equivalent to fill_rainbow(g_LEDs, NUM_LEDS, j, 8);
CRGB c;
for (int i = 0; i < (NUM_LEDS + 1) / 2; i ++)
{
leds[i] = c.setHue(k);
leds[NUM_LEDS - 1 - i] = c.setHue(k);
k+= 8;
}
static int scroll = 0;
scroll++;
for (int i = scroll % 5; i < NUM_LEDS / 2; i += 5)
{
leds[i] = CRGB::Black;
leds[NUM_LEDS - 1 - i] = CRGB::Black;
}
delay(50);
}
void loop() {
DrawTwinkle();
FastLED.show();
}