I'm making something for the holidays and am using WS2811 LEDs and an Arduino. I'm using the FastLED library and I want it that the LEDs display colors, pause, and then have those same LEDs display a new color. Here is my code:
#include <FastLED.h>
#define LED_PIN 13
#define LED_COUNT 10
CRGB leds[LED_COUNT];
void setup() {
FastLED.addLeds<WS2811, LED_PIN>(leds, LED_COUNT);
}
void loop() {
/*
(255,0,0) = Red
(0,255,0) = Green
(0,0,255) = Blue
*/
leds[0] = CRGB(255,255,255);
leds[1] = CRGB(255,255,255);
leds[2] = CRGB(255,255,255);
leds[3] = CRGB(255,255,255);
leds[4] = CRGB(255,255,255);
leds[5] = CRGB(255,255,255);
leds[6] = CRGB(255,255,255);
leds[7] = CRGB(255,255,255);
leds[8] = CRGB(255,255,255);
leds[9] = CRGB(255,255,255);
delay(100);
leds[0] = CRGB(0,0,255);
leds[1] = CRGB(0,0,255);
leds[2] = CRGB(0,0,255);
leds[3] = CRGB(0,0,255);
leds[4] = CRGB(0,0,255);
leds[5] = CRGB(0,0,255);
leds[6] = CRGB(0,0,255);
leds[7] = CRGB(0,0,255);
leds[8] = CRGB(0,0,255);
leds[9] = CRGB(0,0,255);
FastLED.show();
}
My code is very basic because I'm just trying to get it to work before making more logical for loops. Does anyone know how to switch the colors of the LEDs?