// Low power NeoPixel earrings example. Makes a nice blinky display // with just a few LEDs on at any time...uses MUCH less juice than // rainbow display! #include #define PIN 0 Adafruit_NeoPixel pixels = Adafruit_NeoPixel(32, PIN); uint8_t mode = 0, // Current animation effect offset = 0; // Position of spinny eyes uint32_t color = 0xffae00; // Start red uint32_t prevTime; uint8_t maxPixels = 2; const uint32_t mm[] = { 0xff2426, 0xfe3223, 0xfe4121, 0xfd4f1f, 0xfd5e1d, 0xfc6d1b, 0xfc7b18, 0xfb8a16, 0xfb9814, 0xfaa712, 0xfab610, 0xffc20d, 0xffd30b, 0xffe309, 0xfff407, 0xf7ff05 }; void setup() { pixels.begin(); pixels.setBrightness(60); // 1/3 brightness prevTime = millis(); } void loop() { uint8_t i; uint32_t t; switch(mode) { case 0: // Random sparks - just one LED on at a time! i = random(15); color = mm[i]; pixels.setPixelColor(0, color); pixels.setPixelColor(1, color); pixels.show(); i = random(4); delay(5 + (i*5)); pixels.setPixelColor(0, 0); pixels.setPixelColor(1, 0); pixels.show(); break; case 1: // Spinny wheels (8 LEDs on at a time) for(i=0; i 8000) { // Every 8 seconds... mode++; // Next mode if(mode > 1) { // End of modes? mode = 0; // Start modes over color >>= 8; // Next color R->G->B if(!color) color = 0xffae00; // Reset to red } for(i=0; i<32; i++) pixels.setPixelColor(i, 0); prevTime = t; } }