// https://www.reddit.com/r/FastLED/comments/16rmd6y/looking_for_help_by_a_pro_to_find_my_issue/
#include <FastLED.h>
#define NUM_LEDS_PER_STRIP 22
CRGB leds_1[NUM_LEDS_PER_STRIP];
CRGB leds_2[NUM_LEDS_PER_STRIP];
unsigned long myTime;
int a=0;
int b=0;
void setup() {
Serial.begin(9600);
// tell FastLED there's 22 NEOPIXEL leds on pin 5
FastLED.addLeds<NEOPIXEL, 5>(leds_1, NUM_LEDS_PER_STRIP);
// tell FastLED there's 22 NEOPIXEL leds on pin 6
FastLED.addLeds<NEOPIXEL, 6>(leds_2, NUM_LEDS_PER_STRIP);
FastLED.setBrightness(250);
}
void loop()
{
Serial.print("Time: ");
myTime = millis();
Serial.println(myTime);// Gibt die Zeit seit dem Programmstart aus
delay(250); // Eine Sekunde warten, um keine riesigen Datenmengen zu senden
if(myTime>1000)
{
safe_pixel(leds_1, a-1, CRGB( 0, 0, 0));
safe_pixel(leds_1, a+0, CRGB( 150, 0, 0));
safe_pixel(leds_1, a+1, CRGB( 0, 0, 0));
Serial.println("Test1");
FastLED.show();
a++;
Serial.print("a:");
Serial.println(a);
}
if(myTime>1000)
{
safe_pixel(leds_2, b-1, CRGB( 0, 0, 0));
safe_pixel(leds_2, b+0, CRGB( 0, 150, 0));
safe_pixel(leds_2, b+1, CRGB( 0, 0, 0));
Serial.println("Test2");
FastLED.show();
b++;
Serial.print("b:");
Serial.println(b);
}
}
// Write a colour to the given offset on the strip, but
// only if the offset is within the bounds of the strip.
void safe_pixel(CRGB* strip, int offset, CRGB colour) {
if (offset < 0 || offset >= NUM_LEDS_PER_STRIP) {
return;
}
strip[offset] = colour;
}