// Arduino Nano/Uno with one WS2812
#include <FastLED.h> // https://github.com/FastLED/FastLED
#define PIX 1 // number of WS2812
#define PIN 6 // data pin
CRGB led[PIX]; // Create FastLED object (led[])
int maximum = 255; // adjust maximum brightness
bool toggle; // a bit to toggle
unsigned long timer, timeout = 500; // timer
void setup() {
FastLED.addLeds<WS2812, PIN, GRB>(led, PIX); // initialize object
FastLED.clear(); // clear buffer
FastLED.setBrightness(maximum); // set brightness
FastLED.show(); // display buffer
}
void loop() {
if (millis() - timer >= timeout) {
timer = millis(); // reset timing
led[0] = CRGB(0, 0, 255 * toggle); // send color to buffer
FastLED.show(); // show buffer
FastLED.clear(); // clear buffer
toggle = !toggle; // toggle on/off multiplier
}
}