Created
June 22, 2014 18:54
-
-
Save justinian/cb9083d0065657c8147b to your computer and use it in GitHub Desktop.
Janice's Goggles
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 <Adafruit_NeoPixel.h> | |
#define PIN 1 | |
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(32, PIN); | |
uint32_t colors[] = { | |
0xdf151a, | |
0xfd8603, | |
0xf4f328, | |
0x00da3c, | |
0x00cbe7, | |
0xaa00ff, | |
0xff00aa, | |
0x00ff00 | |
}; | |
uint8_t num_colors = sizeof(colors)/sizeof(uint32_t); | |
void setup() { | |
pixels.begin(); | |
pixels.setBrightness(85); // 1/3 brightness | |
} | |
#define ON_COUNT 3 | |
void loop() { | |
uint8_t index[ON_COUNT]; | |
for(int i=0; i<ON_COUNT; i++) { | |
index[i] = random(32); | |
uint8_t c = random(num_colors); | |
pixels.setPixelColor(index[i], colors[c]); | |
} | |
pixels.show(); | |
delay(30); | |
for(int i=0; i<ON_COUNT; i++) | |
pixels.setPixelColor(index[i], 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment