Created
October 30, 2016 13:58
-
-
Save nervetattoo/2acdb038afd6511d8fb387ed45de9b63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "neopixel.h" | |
#define PIXEL_COUNT 29 | |
#define PIXEL_PIN D2 | |
#define PIXEL_TYPE WS2812B | |
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE); | |
int pos = -1; | |
int lightUp(String strPos) { | |
pos = strPos.toInt(); | |
return pos; | |
} | |
void setup() { | |
Particle.function("lightUp", lightUp); | |
strip.begin(); | |
strip.show(); | |
} | |
void loop() { | |
for (int i=0; i<strip.numPixels(); i++) { | |
if (i == pos) { | |
strip.setPixelColor(i, strip.Color(255, 0, 0, 255)); | |
} else { | |
strip.setPixelColor(i, strip.Color(0, 0, 0, 0)); | |
} | |
} | |
strip.show(); | |
delay(1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment