// 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 light_ring = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
void setup() {
light_ring.begin();
light_ring.show(); // initialize everything to off.
}
void loop() {
// Version 1 - all blue
for( int i = 0; i < light_ring.numPixels(); i++ ){
light_ring.setPixelColor( i, 0, 0, 255);
// as this appears IN the loop
// will change one-pixel at a time
light_ring.show();
delay( 500 );
}
{
// Version 1 - all red
for( int i = 0; i < light_ring.numPixels(); i++ ){
light_ring.setPixelColor( i, 255, 0, 0);
// as this appears IN the loop
// will change one-pixel at a time
light_ring.show();
delay( 500 );
}
{// Version 1 - all green
for( int i = 0; i < light_ring.numPixels(); i++ ){
light_ring.setPixelColor( i, 0, 255, 0);
// as this appears IN the loop
// will change one-pixel at a time
light_ring.show();
delay( 500 );
}
{
// Version 1 - all white
for( int i = 0; i < light_ring.numPixels(); i++ ){
light_ring.setPixelColor( i, 255, 255, 255);
// as this appears IN the loop
// will change one-pixel at a time
light_ring.show();
delay( 500 );
}
// turn the neopixels off
for( int i = 0; i < light_ring.numPixels(); i++ ){
light_ring.setPixelColor( i, 0, 0 , 0 );
}
light_ring.show();
delay( 1000 );
}
}
}
}
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. .