Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
iotfuse presentation
// This #include statement was automatically added by the Particle IDE.
#include "neopixel/neopixel.h"
Adafruit_NeoPixel strip = Adafruit_NeoPixel(4, D3, WS2812);
int red = 0;
int green = 0;
int blue = 0;
void setup() {
Particle.function("setColor", setColor);
void loop() {
void displayColor(){
for(int i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, red, green, blue);
int setColor(String command){
int commaIndex1 = command.indexOf(',');
int commaIndex2 = command.indexOf(',', commaIndex1+1);
red = command.substring(0, commaIndex1).toInt();
green = command.substring(commaIndex1+1, commaIndex2).toInt();
blue = command.substring(commaIndex2+1).toInt();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.