CNAP

LED Ring Reference

A 16-pixel WS2812B addressable LED ring, driven over a single data line and chainable via DOUT.

Pin names

NameDescription
VCCPower (5V)
GNDGround
DINData In — connect to a GPIO pin
DOUTData Out — chain to the next ring/strip's DIN

Attributes

This component has no configurable attributes.

Usage

Connect VCC to 5V, GND to GND, and DIN to a GPIO pin. Drive it with the FastLED or Adafruit NeoPixel library using the WS2812B protocol.

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

Examples

DescriptionAttrs
Default 16-pixel ring{}

See also

  • NeoPixel — single addressable pixel using the same WS2812B protocol
  • NeoPixel Matrix — addressable pixels arranged in a grid
  • LED Bar Graph — discrete LEDs driven individually instead of over a data line