Arduino Example

Arduino NeoPixel LED Example

Control WS2812 NeoPixel LEDs.

Wiring

Check pinout, power supply, common GND and voltage levels before connecting the module.

Full code

#include <Adafruit_NeoPixel.h>
#define PIN 6
#define NUM_LEDS 8

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

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

void loop() {
  for (int i = 0; i < NUM_LEDS; i++) {
    strip.setPixelColor(i, strip.Color(0, 80, 255));
    strip.show();
    delay(100);
  }
}

How it works

This lesson matches the page title and gives a clean starting point for this exact example.

Common mistakes

Check board selection, wiring, libraries, power supply and serial monitor baud rate.

Frequently asked questions

Can I copy this code?

Yes. Adapt pins, credentials and libraries for your board.

Why does it not compile?

Install required libraries and select the correct board.