Skip to content

Instantly share code, notes, and snippets.

@justinian
Created June 22, 2014 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinian/cb9083d0065657c8147b to your computer and use it in GitHub Desktop.
Save justinian/cb9083d0065657c8147b to your computer and use it in GitHub Desktop.
Janice's Goggles
#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