top of page

Arduino Neopixel Lights

  • 3 hours ago
  • 1 min read



NeoPixel is Adafruit’s name for addressable RGB (or RGBW) LED products—most commonly based on the WS2812/WS2812B (and similar) LED chips—that you can control with an Arduino using one data pin.


Wiring

  • 5V (or 3.3V on some strips) to the strip’s +V

  • GND to GND (Arduino and LED power supply grounds must be connected)

  • DIN (data-in) to an Arduino digital pin (often through a ~330–470 Ω resistor)


Common color orders:

  • NEO_RGB - Red, Green, Blue (in that order)

  • NEO_GRB - Green, Red, Blue (most common, including WS2812B)

  • NEO_BRG - Blue, Red, Green

  • NEO_RBG - Red, Blue, Green


Two common speeds:

  • NEO_KHZ800 - 800 kHz (most common, modern strips like WS2812B)

  • NEO_KHZ400 - 400 kHz (older strips)

#include <Adafruit_NeoPixel.h>

// ===== SETTINGS =====
const int LED_PIN = 6;           // Pin connected to NeoPixels
const int NUM_LEDS = 16;         // Number of LEDs in your strip/ring
const int ANIMATION_SPEED = 500; // Delay in milliseconds

// Create NeoPixel object
Adafruit_NeoPixel strip(NUM_LEDS, LED_PIN, NEO_GRB + NEO_KHZ800);



void setup() {
  strip.begin();           // Initialize the LED strip
  strip.show();            // Turn all LEDs off at start
  strip.setBrightness(50); // Set brightness (0-255)
}

void loop() {
  // Light up each LED one by one in green
  for (int i = 0; i < NUM_LEDS; i++) {
    strip.clear();                      // Turn off all LEDs
    strip.setPixelColor(i, 0, 150, 0);  // Set current LED to green (R, G, B)
    strip.show();                       // Update the strip
    delay(ANIMATION_SPEED);             // Wait before next LED
  }
}

Comments


bottom of page