#include <Adafruit_NeoPixel.h>
#define PIN_WS2812B 2
#define NUM_PIXELS 6
Adafruit_NeoPixel WS2812B(NUM_PIXELS, PIN_WS2812B, NEO_GRB + NEO_KHZ800);
void setup() {
// put your setup code here, to run once:
WS2812B.begin();
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
WS2812B.clear();
WS2812B.show();
delay(1000);
for (int pixel = 0; pixel < NUM_PIXELS; pixel++) {
WS2812B.setPixelColor(pixel,WS2812B.Color(0,255,0));
WS2812B.show();
delay(500);
WS2812B.setPixelColor(pixel,WS2812B.Color(207,80,47));
WS2812B.show();
delay(500);
}
for (int pixel = 0; pixel < NUM_PIXELS; pixel++) { // for each pixel
WS2812B.setPixelColor(pixel, WS2812B.Color(255, 0, 0)); // it only takes effect if pixels.show() is called
}
WS2812B.show(); // send the updated pixel colors to the WS2812B hardware.
delay(2000); // on time
for (int pixel = NUM_PIXELS; pixel >=0; pixel--) { // for each pixel
WS2812B.setPixelColor(pixel, WS2812B.Color(66, 148, 183)); // it only takes effect if pixels.show() is called
WS2812B.show(); // send the updated pixel colors to the WS2812B hardware.
delay(500); // on time
}
for (int pixel =0; pixel <255; pixel++){
// Serial.println(pixel);
WS2812B.setPixelColor(4, WS2812B.Color(pixel, 255-pixel, pixel)); // it only takes effect if pixels.show() is called
WS2812B.show();
delay(150);
}
WS2812B.clear(); // set all pixel colors to 'off'
WS2812B.show();
delay(1500);
}