#include <Adafruit_NeoPixel.h>
#include <math.h>
#define PIN_WS2812B 26 // The ESP32 pin GPIO16 connected to WS2812B
#define NUM_PIXELS 17 // The number of LEDs (pixels) on WS2812B LED strip
int area_num = 1, area1 = 17;
Adafruit_NeoPixel ws2812b(NUM_PIXELS, PIN_WS2812B, NEO_GRB + NEO_KHZ800);
void setup() {
pinMode (PIN_WS2812B, OUTPUT);
ws2812b.begin(); // initialize WS2812B strip object (REQUIRED)
}
void loop() {
// ws2812b.clear(); // set all pixel colors to 'off'. It only takes effect if pixels.show() is called
// turn pixels to green one-by-one with delay between each pixel
for (int pixel = 0; pixel < area1; pixel++)
{ // for each pixel
ws2812b.setPixelColor(pixel, ws2812b.Color(255, 0, 255)); // it only takes effect if pixels.show() is called
ws2812b.show(); // update to the WS2812B Led Strip
// delay(50); // 500ms pause between each pixel
}
// delay (1000);
}