// This #include statement was automatically added by the Particle IDE.
#include <neopixel.h>
//Set the neopixel to pin 5
#define PIXEL_PIN D4
//Set the pixel count
#define PIXEL_COUNT 32
//Set the neopixel type
#define PIXEL_TYPE WS2812
long last = 0;
void setup()
{
strip.begin();
strip.show(); // Initialize all pixels to 'off'
Particle.function("Event",event_flag);
}
void event_flag(const char *event, const char *data)
{
activate_neopixel();
}
void activate_neopixel( ){
uint16_t i;
uint32_t off = strip.Color(0, 0, 0,0);
uint32_t color = strip.Color(0, 0, 205,0);
uint32_t w = strip.Color(25,25,25,25);
int j =0;
for(i=0; i< strip.numPixels(); i++)
{
strip.setPixelColor(i, color );
strip.show();
}
long start = millis();
while (start - last < 900000)
{
j++;
for(i=0; i< strip.numPixels(); i++)
{
strip.setPixelColor(i, 25,25,205-j,25 );
strip.show();
}
delay(5000);
}
}
Click to Expand