03 / Templates · intermediate
LED RING RAINBOW
Open in Playground16-pixel NeoPixel ring running a spinning rainbow chase via FastLED. Data driven from a single pin using the WS2812B protocol.
intermediateNeoPixelWS2812BFastLEDRGBanimation
sketch.inoArduino C++
22 lines
// LED Ring — spinning rainbow chase (FastLED)
#include <FastLED.h>
#define NUM_LEDS 16
#define DATA_PIN 6
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(80);
}
void loop() {
static uint8_t hue = 0;
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CHSV(hue + (i * 256 / NUM_LEDS), 255, 255);
}
FastLED.show();
hue++;
delay(20);
}- Arduino Uno01
- LED Ring (wokwi-led-ring)02
| Component Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| DIN (Data In) | Pin 6 |