image.png

Wiring NeoPixel to NodeMCU-32

NeoPixel Ring:

  1. Neopixel GND ↔ NodeMCU-32 GND
  2. Neopixel Vcc ↔ NodeMCU-32 5V
  3. Neopixel DI(Digital In) ↔ NodeMCU-32 GPIO2

Pushbutton

image.png

  1. Pushbutton Pin 1 ↔ NodeMCU-32 GPIO4
  2. Pushbutton Pin 2 ↔ NodeMCU-32 GND

Rotary Variable Resistor (Potentiometer)

  1. Potentiometer Pin 1 ↔ NodeMCU-32 3.3V
  2. Potentiometer Pin 2 ↔ NodeMCU-32 GPIO32
  3. Potentiometer Pin 3 ↔ NodeMCU-32 GND

Coding Example

1. Chasing (Running) Light

Lights light up one by one around the ring

#include <Adafruit_NeoPixel.h>

#define PIN 23
#define NUMPIXELS 12

Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

#define DELAYVAL 100 // Adjust for speed

void setup() {
  pixels.begin();
  pixels.clear();
  pixels.show();
}

void loop() {
  pixels.clear();  // Clear all pixels
  for (int i = 0; i < NUMPIXELS; i++) {
    pixels.setPixelColor(i, 0, 255, 0);  // Turn on one pixel green
    pixels.show();
    delay(DELAYVAL);  // Wait
  }
}

Code explanation: