#include <FastLED.h>
#define NUM_LEDS_1 12
#define DATA_PIN_1 6
#define COLOR_ORDER GRB
#define CHIPSET_1 WS2812
#define BRIGHTNESS_0 255
#define BRIGHTNESS_2 255
#define VOLTS 5
#define MAX_AMPS 500
CRGB leds[NUM_LEDS_1];
unsigned long previousMillis = 0;
unsigned long previousMillisLed0 = 0;
unsigned long previousMillisLed11 = 0;
unsigned long currentMillis = millis();
const long interval1 = 60;
const long interval0 = 500;
const long interval5 = 500;
bool stateLed0 = true;
bool stateLed11 = true;
void setup() {
Serial.begin(115200);
FastLED.addLeds<CHIPSET_1, DATA_PIN_1, COLOR_ORDER>(leds, NUM_LEDS_1);
FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS, MAX_AMPS);
FastLED.setBrightness(BRIGHTNESS_2);
FastLED.clear();
Serial.println("Set up complete");
}
void loop() {
Serial.println("Black");
if (stateLed0 && (millis() - previousMillisLed0 >= 400)) {
leds[10] = CRGB::Black;
FastLED.show();
stateLed0 = false;
}
Serial.println("White");
unsigned long currentMillis = millis();
for (int i = 10; i > 1; i--) {
leds[i] = CRGB(255, 255, 255);
FastLED.show();
while (millis() - currentMillis < interval1) {
// wait approx. [interval] ms
}
currentMillis = millis();
}
Serial.println("Orange");
leds[1] = CRGB(255, 120, 0);
FastLED.show();
while (millis() - currentMillis < interval1) {
// wait approx. [interval] ms
}
Serial.println("Red");
currentMillis = millis();
leds[1] = CRGB(255, 0, 0);
FastLED.show();
while (millis() - currentMillis < 250) {
// wait approx. 250 ms
}
currentMillis = millis();
Serial.println("OrangeRed");
leds[1] = CRGB(255, 70, 0);
FastLED.show();
while (millis() - currentMillis < 250) {
// wait approx. 200 ms
}
FastLED.clear();
Serial.println("\nClear");
}