Sample content. This page shows how a tutorial reads. Replace the text with your own, then delete sample: true from the front matter.

ESP Web Server for Addressable Lights · Part 2 of 6

Hello, Pixels: Your First Test Sketch

Install the pixel library, upload a short rainbow sketch, and confirm all 200 lights respond before you add Wi-Fi.

Sheet
ELE-002
Level
Beginner
Build time
30 min
Est. cost
$0 (uses Part 1 hardware)
Revised
Oct 28, 2026

Video goes here

Add youtube: VIDEO_ID to this page's front matter. The video loads when a reader presses play.

What you will do

  • Install the board package and the pixel library in the Arduino IDE
  • Upload a rainbow sketch that caps brightness to protect your supply
  • Read the symptoms that tell you which part of the wiring to check

Before the board hosts a web page, prove the lights work on their own. A moving rainbow lights every pixel, so it shows wiring problems fast.

Step 1: Set up the Arduino IDE#

  1. Open Boards Manager and install the package for your board: esp8266 or esp32.
  2. Open Library Manager, search for Adafruit NeoPixel, and install it.
  3. Select your board and port under the Tools menu.
  • Board package installed
  • Adafruit NeoPixel library installed
  • Board and port selected

Step 2: Upload the sketch#

Copy the sketch below into a new window, set the pin number for your board, and upload it. The sketch keeps the brightness low on purpose, so a first test cannot overload the supply.

rainbow_test.ino
#include <Adafruit_NeoPixel.h>

#define LED_PIN    D4     // NodeMCU and Wemos labels. On an ESP32, use a GPIO number such as 5.
#define LED_COUNT  200
#define BRIGHTNESS 60     // 0 to 255. Raise it only after the power wiring is proven.

Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();
  strip.setBrightness(BRIGHTNESS);
  strip.show();           // start with every pixel off
}

void loop() {
  for (uint16_t offset = 0; offset < 65536UL; offset += 256) {
    for (int i = 0; i < LED_COUNT; i++) {
      uint16_t hue = offset + (uint32_t)i * 65536UL / LED_COUNT;
      strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(hue)));
    }
    strip.show();
    delay(10);
  }
}
  • Pin number matches the pin you wired in Part 1
  • Sketch uploads without errors
  • A rainbow moves along the whole string

Troubleshooting#

Only the first few pixels light. The data signal is being lost after those pixels. Check the data connection between the last working pixel and the next one.

Colors are wrong, such as red where green should be. Your pixels use a different color order. Change NEO_GRB to NEO_RGB and upload again.

The board resets when the lights start. The pixels are pulling power from the wrong place. Go back to Part 1 and check that the pixels run from the supply, not the board.

What is next#

The next part puts a web page on the board. See the full series for the plan.

Got stuck, or got a different result?

Leave a comment on the video with what you see. Include your board, your power supply, and what you see happening.

Open the video comments