#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 minutes = 15;
int max_intensity = 50;
int red_intensity = 0;
void setup() {
strip.begin(); //Initialize neopixel
strip.show(); //Initialize all pixels to 'off'
Particle.function("Meeting", meetingOrb);
Particle.variable("Red Intensity", red_intensity);
}
void loop() {
}
int meetingOrb(String input)
{
int ms_max = minutes*60*1000;
// unsigned long now = millis();
uint32_t c = strip.Color(red_intensity, 0, 0);
uint16_t i;
uint16_t j;
int delay_time = map(1, 0, max_intensity, 0, ms_max);
for(i=0; i <= max_intensity; i++){
c = strip.Color(i,0,0);
for(j=0; j<strip.numPixels(); j++){
strip.setPixelColor(j,c);
}
strip.show();
delay(delay_time);
}
for(i=0; i <= max_intensity; i++){
c = strip.Color(max_intensity,i,i);
for(j=0; j<strip.numPixels(); j++){
strip.setPixelColor(j,c);
}
strip.show();
delay(delay_time);
}
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. .