#include <FastLED.h>
#define LED_DATA_A 5
#define LED_DATA_B 6
#define LED_DATA_C 7
#define COLOR_ORDER GRB
#define LED_TYPE WS2812B
#define NUM_LEDS_PER_STRIP 16
const int PositionOffsetbetweenStrips = 9;
const int LEDshowStartDelayinSeconds = 1 ;
const int PointTransistionDelayinMicroSeconds = 100 ; //Time between each pattern on the led strip in Milliseconds
const int NumberofBrightLedsaroundtheSideofPoint = 03 ; //set the number of LEDs on each side of the centre bright point, right now its 03 with values 50, 25 , 0 on each side of the bright centre led with 150 value.
CRGB leds_A[NUM_LEDS_PER_STRIP];
CRGB leds_B[NUM_LEDS_PER_STRIP];
CRGB leds_C[NUM_LEDS_PER_STRIP];
unsigned long myTime;
int PosA = 0;
int PosB = 0;
int PosC = 0;
unsigned int Pos( int PositionValue ) ;
void setup() {
Serial.begin(9600);
// tell FastLED there's 22 NEOPIXEL leds on pin 5
FastLED.addLeds<LED_TYPE, LED_DATA_A>(leds_A, (NUM_LEDS_PER_STRIP));
// tell FastLED there's 22 NEOPIXEL leds on pin 6
FastLED.addLeds<LED_TYPE, LED_DATA_B>(leds_B, (NUM_LEDS_PER_STRIP)) ;
// tell FastLED there's 22 NEOPIXEL leds on pin 6
FastLED.addLeds<LED_TYPE, LED_DATA_C>(leds_C, (NUM_LEDS_PER_STRIP)) ;
FastLED.setBrightness(255);
}
void loop()
{
myTime = millis()/1000;
if( myTime> LEDshowStartDelayinSeconds)
{
for (int index = 0 ; index < ((NUM_LEDS_PER_STRIP)); index++ ) {
Serial.print("Time: ");
Serial.println(millis()/1000);// Gibt die Zeit seit dem Programmstart aus
PosA = index + NumberofBrightLedsaroundtheSideofPoint;
PosB = PosA + PositionOffsetbetweenStrips ;
PosC = PosB + PositionOffsetbetweenStrips ;
// for ( uint8_t Pos = 0 ; Pos <= (NUM_LEDS_PER_STRIP- ) )
leds_A[ Pos((PosA-3)) ] = CRGB( 0, 0, 0);
leds_A[ Pos((PosA-2)) ] = CRGB( 0, 10, 0);
leds_A[ Pos((PosA-1)) ] = CRGB( 0, 50,0);
leds_A[ Pos((PosA+0)) ] = CRGB( 0, 250, 0);
leds_A[ Pos((PosA+1)) ] = CRGB( 0, 50, 0);
leds_A[ Pos((PosA+2)) ] = CRGB( 0, 10, 0);
leds_A[ Pos((PosA+3)) ] = CRGB( 0, 0, 0);
Serial.println("Test1");
FastLED.show();
Serial.print(" PosA :");
Serial.println(PosA);
leds_B[ Pos((PosB-3)) ] = CRGB( 0, 0, 0);
leds_B[ Pos((PosB-2)) ] = CRGB( 0, 10, 0);
leds_B[ Pos((PosB-1)) ] = CRGB( 0, 50, 0);
leds_B[ Pos((PosB+0)) ] = CRGB( 0, 250, 0);
leds_B[ Pos((PosB+1)) ] = CRGB( 0, 50, 0);
leds_B[ Pos((PosB+2)) ] = CRGB( 0, 10, 0);
leds_B[ Pos((PosB+3)) ] = CRGB( 0, 0, 0);
Serial.println("Test2");
FastLED.show();
Serial.print("PosB :");
Serial.println(PosB);
leds_C[ Pos((PosC-3)) ] = CRGB( 0, 0, 0);
leds_C[ Pos((PosC-2)) ] = CRGB( 0, 10, 0);
leds_C[ Pos((PosC-1)) ] = CRGB( 0, 50, 0);
leds_C[ Pos((PosC+0)) ] = CRGB( 0, 250, 0);
leds_C[ Pos((PosC+1)) ] = CRGB( 0, 50, 0);
leds_C[ Pos((PosC+2)) ] = CRGB( 0, 10, 0);
leds_C[ Pos((PosC+3)) ] = CRGB( 0, 0, 0);
Serial.println("Test3");
FastLED.show();
Serial.print("PosC :");
Serial.println(PosC);
delay(PointTransistionDelayinMicroSeconds);
}
}
}
unsigned int Pos( int PositionValue ) {
if ( PositionValue >= NUM_LEDS_PER_STRIP ) {
PositionValue = PositionValue - NUM_LEDS_PER_STRIP ;
return PositionValue ;
}
else if (PositionValue<0 ) {
PositionValue = 0 ;
return PositionValue ;
}
else { return PositionValue ; }
}