#include "neopixel.h"
#define PIXEL_PIN D2
#define PIXEL_COUNT 16
#define PIXEL_TYPE WS2812
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
void setup(){
strip.begin();
// Initialize all pixels to "off"
strip.show();
}
void loop(){
uint16_t i;
uint32_t c = strip.Color(0, 25, 25);
uint32_t off = strip.Color(0, 0, 0);
// turn the pixel on one by one
for(i=0; i < strip.numPixels(); i++){
strip.setPixelColor(i, c);
strip.show();
delay(200);
}
delay(500);
// reverse the sequence and turn the pixel off one by one
for(i=strip.numPixels(); i > 0; i--){
strip.setPixelColor(i, off);
strip.show();
delay(200);
}
delay(500);
}
Click to Expand
Content Rating
Is this a good/useful/informative piece of content to include in the project? Have your say!
You must login before you can post a comment. .