Back to Parent

// 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);

bool meetingStatus = false;

void setup() {

  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
  
  Particle.function("meetingsoon", meetingSoon);
  
}

int meetingSoon(String command){
    
    if ( command == "yes" ){
        meetingStatus = true;
    } else if ( command == "no" ){
        meetingStatus = false;
    }
    return 0;
}
    
void loop() {
    
      uint32_t white = strip.Color(255,255,255); // white
      uint32_t red = strip.Color( 255,0, 0 ); // red
      
      if ( meetingStatus == true ){
          
        for( int i = 0; i < strip.numPixels(); i++ ){
        strip.setPixelColor(i, red); 
        strip.setBrightness(50);
        }
        strip.show();
        delay( 100 );
          
      } else {
          
        for( int i = 0; i < strip.numPixels(); i++ ){
        strip.setPixelColor(i, white); 
        strip.setBrightness(50);
        }
        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!

0