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

int pixelNum = 0;
int redValue = 255;
int greenValue = 255;
int blueValue = 255;

void setup() {

  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
  
  Particle.function("red", redVal);
  Particle.function("green", greenVal);
  Particle.function("blue", blueVal);
  
}

int redVal(String val){

    redValue = val.toInt();
    return redValue;
}

int greenVal(String val){

    greenValue = val.toInt();
    return greenValue;
}

int blueVal(String val){

    blueValue = val.toInt();
    return blueValue;
}
    

void loop() {

  uint16_t i;
     
    for( int i = 0; i < strip.numPixels(); i++ ){
       strip.setPixelColor(i, redValue, greenValue, blueValue); // set a color 
       strip.setBrightness(20);
    }
    strip.show();
    delay( 100 );
    
    Particle.process();
}
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0