Skip to content

NeoPixel Ring Patterns

Animate the 8‑LED ring on D5.

Wiring

  • DIN→D5, VCC→5V, GND→GND

Code

#include <Adafruit_NeoPixel.h>

#define PIN 5
#define N   8

Adafruit_NeoPixel strip(N, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();
  strip.show();
}

void colorWipe(uint32_t c, uint8_t wait) {
  for (int i = 0; i < N; i++) {
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}

void loop() {
  colorWipe(strip.Color(255, 0, 0), 50);
  colorWipe(strip.Color(0, 255, 0), 50);
  colorWipe(strip.Color(0, 0, 255), 50);
}