// This #include statement was automatically added by the Particle IDE.
#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);
int numPixels = strip.numPixels();
void setup() {
strip.begin();
strip.show();
}
void loop() {
uint16_t i;
uint32_t c1 = strip.Color(0, 0, 255); // Blue
for( int i = 0; i < strip.numPixels(); i++ ){
strip.setPixelColor(i, c1); // set a color
strip.show();
delay( 100 );
}
uint32_t c2 = strip.Color(0, 0, 0); //turning off by removing color
for( int i = numPixels; i >0; i-- ){
strip.setPixelColor(i, c2); // set a color
strip.show();
delay( 100 );
}
uint32_t c3 = strip.Color(0, 255, 0); // Blue
for( int i = 0; i < strip.numPixels(); i++ ){
strip.setPixelColor(i, c3); // set a color
strip.show();
delay( 100 );
}
for( int i = numPixels; i >0; i-- ){
strip.setPixelColor(i, c2); // set a color
strip.show();
delay( 100 );
}
uint32_t c4 = strip.Color(255, 0, 0); // Blue
for( int i = 0; i < strip.numPixels(); i++ ){
strip.setPixelColor(i, c4); // set a color
strip.show();
delay( 100 );
}
for( int i = numPixels; i >0; i-- ){
strip.setPixelColor(i, c2); // set a color
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. .