// This #include statement was automatically added by the Particle IDE.
#include <neopixel.h>
// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_PIN D2
#define PIXEL_COUNT 16
#define PIXEL_TYPE WS2812
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
int pixelNum = 0;
void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
uint16_t i;
uint32_t blue = strip.Color(0, 0, 255); //blue
uint32_t off = strip.Color(0, 0, 0); //off
for( int i = 0; i < strip.numPixels(); i++ ){
if (i != pixelNum) {
strip.setPixelColor(i, off);
}
else {
strip.setPixelColor(i, blue); // set a color
strip.setBrightness(20);
}
}
pixelNum++;
if (pixelNum >= strip.numPixels()) {
pixelNum = 0;
}
strip.show();
delay(100);
}
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. .