Hi everyone,
I am using the led strip WS2812B.
I have 60 LED and I want to turn all of them on at the same time.
So far, I can turn on the first one if I do this:
#include <FastLED.h>
#define LED_PIN 7
#define NUM_LEDS 60
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
}
void loop() {
leds[1] = CRGB ( 0, 0, 255);
FastLED.show();
delay(1000);
leds[1] = CRGB ( 255, 0, 0);
FastLED.show();
delay(1000);
}
Or, I can turn them on one at a time if I do this:
#include <FastLED.h>
#define LED_PIN 7
#define NUM_LEDS 60
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
}
void loop() {
for (int i = 0; i <= 59; i++) {
leds[i] = CRGB ( 0, 0, 255);
FastLED.show();
}
delay(1000);
for (int i = 59; i >= 0; i--) {
leds[i] = CRGB ( 255, 0, 0);
FastLED.show();
}
delay(1000);
}
How do I turn all of them on at the same time?
Thank you in advance for your time