CCNAP

TPL-03Templates/LED Ring Rainbow

LED Ring Rainbow

16-pixel NeoPixel ring running a spinning rainbow chase via FastLED. Data driven from a single pin using the WS2812B protocol.

Open in Playgroundintermediate · NeoPixel · WS2812B · FastLED · RGB · animation
intermediate

FIG. 1LED Ring Rainbow · circuitTPL-03

02Sketch

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);
}

03Components

  • 01Arduino Uno
  • 02LED Ring (wokwi-led-ring)

04Wiring

Component pinArduino pin
VCC5V
GNDGND
DIN (Data In)Pin 6

All templates

Ready when you are

Have a circuit in mind?

No hardware, no installs — a browser is enough.