Hallo
I am a new arduino user and I need somehelp with my project
I wrote a sketch, but it does not work properly. when I use my sketch, all LEDs will blink white.
I use 7 Ledstrips (WS2812) on several pins of my arduiono Nano.
all LED strips use about 25 LEDs. but for my test I temporarily use 4 LEDs
the 1st LEDstrip I would like to blink white light.
the 2nd LEDstrip I also want to blink white light only when the 1st LEDstrip is off, and vice versa.
I want the 3nd LEDstrip to be constantly RED, and on the 4th LEDlight I want to be constantly GREEN.
the 5th, 6th and 7th LED strip I want whitelight with different pause times
what I am doing wrong and who can help me with this.
#include "FastLED.h"
#define NUM_LEDS 4
#define NUM_STRIPS 7
CRGB leds[NUM_LEDS];
CLEDController *controllers[NUM_STRIPS];
uint8_t gBrightness = 100; //full brightness = 128
void setup() {
controllers[0] = &FastLED.addLeds<WS2812,2>(leds, NUM_LEDS); // strip 1 on pin 2
controllers[1] = &FastLED.addLeds<WS2812,3>(leds, NUM_LEDS); // strip 2 on pin 3
controllers[2] = &FastLED.addLeds<WS2812,4>(leds, NUM_LEDS); // strip 3 on pin 4
controllers[3] = &FastLED.addLeds<WS2812,5>(leds, NUM_LEDS); // strip 4 on pin 5
controllers[4] = &FastLED.addLeds<WS2812,6>(leds, NUM_LEDS); // strip 5 on pin 6
controllers[5] = &FastLED.addLeds<WS2812,7>(leds, NUM_LEDS); // strip 6 on pin 7
controllers[6] = &FastLED.addLeds<WS2812,8>(leds, NUM_LEDS); // strip 7 on pin 8
}
void loop() {
controllers[0]->showLeds(gBrightness); //Ledstrip 1 (WS2812) blinking opposite from strip 2
// Turn the LED on, then pause
leds[0] = CRGB::White;
leds[1] = CRGB::White;
leds[2] = CRGB::White;
leds[3] = CRGB::White;
FastLED.show();
delay(500);
// Now turn the LED off, then pause
leds[0] = CRGB::Black;
leds[1] = CRGB::Black;
leds[2] = CRGB::Black;
leds[3] = CRGB::Black;
FastLED.show();
delay(500);
/////////////////////////////////
controllers[1]->showLeds(gBrightness); //Ledstrip 2 (WS2812) blinking opposite from strip 1
// Turn the LED on, then pause
leds[0] = CRGB::White;
leds[1] = CRGB::White;
leds[2] = CRGB::White;
leds[3] = CRGB::White;
FastLED.show();
delay(500);
// Now turn the LED off, then pause
leds[0] = CRGB::Black;
leds[1] = CRGB::Black;
leds[2] = CRGB::Black;
leds[3] = CRGB::Black;
FastLED.show();
delay(500);
/////////////////////////////////////////////
// draw led data for the 1 strand into leds //ledstrip 3 (WS2812) constand on Red
fill_solid(leds, NUM_LEDS, CRGB::Red);
controllers[2]->showLeds(gBrightness);
/////////////////////////////////////////////
// draw led data for the 2 strand into leds //ledstrip 4 (WS2812) constand on Green
fill_solid(leds, NUM_LEDS, CRGB::Green);
controllers[3]->showLeds(gBrightness);
/////////////////////////////////////////////
controllers[4]->showLeds(gBrightness); //Ledstrip 5 (WS2812) blinking
// Turn the LED on, then pause
leds[0] = CRGB::White;
leds[1] = CRGB::White;
leds[2] = CRGB::White;
leds[3] = CRGB::White;
FastLED.show();
delay(1500);
// Now turn the LED off, then pause
leds[0] = CRGB::Black;
leds[1] = CRGB::Black;
leds[2] = CRGB::Black;
leds[3] = CRGB::Black;
FastLED.show();
delay(1500);
/////////////////////////////////////////////
controllers[5]->showLeds(gBrightness); //Ledstrip 6 (WS2812) blinking
// Turn the LED on, then pause
leds[0] = CRGB::White;
leds[1] = CRGB::White;
leds[2] = CRGB::White;
leds[3] = CRGB::White;
FastLED.show();
delay(800);
// Now turn the LED off, then pause
leds[0] = CRGB::Black;
leds[1] = CRGB::Black;
leds[2] = CRGB::Black;
leds[3] = CRGB::Black;
FastLED.show();
delay(800);
///////////////////////////////////////////
controllers[6]->showLeds(gBrightness); //Ledstrip 7 (WS2812) blinking
// Turn the LED on, then pause
leds[0] = CRGB::White;
leds[1] = CRGB::White;
leds[2] = CRGB::White;
leds[3] = CRGB::White;
FastLED.show();
delay(300);
// Now turn the LED off, then pause
leds[0] = CRGB::Black;
leds[1] = CRGB::Black;
leds[2] = CRGB::Black;
leds[3] = CRGB::Black;
FastLED.show();
delay(300);
}