// 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);
long startTime = 0;
long endTime = 0;
long preTime = 0;
int event(String trigger);
//for light color iteration
int x = 255;
void setup() {
Particle.function("event", event);
strip.begin();
strip.show();
}
void loop() {
if(millis() < startTime){
for(int i = 0; i<16; i++){
uint32_t c = strip.Color(255, x, x);
strip.setPixelColor(i, c);
}
strip.show();
x--;
delay(3529);
}
if(millis() > startTime && millis() < endTime){
for(int i = 0; i<16; i++){
uint32_t c = strip.Color(255, x, x);
strip.setPixelColor(i, c);
}
strip.show();
x++;
delay(3529);
}
if(endTime > 0 && millis() > endTime){
strip.clear();
strip.show();
preTime = 0;
startTime = 0;
endTime = 0;
}
}
int event(String trigger){
strip.Color(255,255,255);
strip.show();
preTime = millis();
startTime = preTime + 900000;
endTime = startTime + 900000;
return 1;
}
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. .