/**************************************************************************/ /* NeoPixel_Headband: displays fancy NeoPixel patterns on a headband v1.0 5/13/15 - NeoPixel 15 strip Based on Adafruit's strandtest code. ----> https://www.adafruit.com/ Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! */ /**************************************************************************/ #include #define PIN 0 // Parameter 1 = number of pixels in strip // Parameter 2 = pin number (most are valid) // Parameter 3 = pixel type flags, add together as needed: // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2) Adafruit_NeoPixel strip = Adafruit_NeoPixel(15, PIN, NEO_GRB + NEO_KHZ800); /* Some other colors colorWipe(strip.Color(219,112,147), 50); // pink colorWipe(strip.Color(135,206,255), 50); // skyBlue colorWipe(strip.Color(128,158,10), 50); // maize colorWipe(strip.Color(88,2,163), 50); // lavender colorWipe(strip.Color(32,178,170), 50); // seaFoam colorWipe(strip.Color(102,205,0), 50); // spring colorWipe(strip.Color(237,120,6), 50); // orange */ void setup() { strip.begin(); strip.show(); // Initialize all pixels to 'off' strip.setBrightness(85); // 1/3 brightness } void loop() { // Some example procedures showing how to display to the pixels: // sparks(40); colorWipe(strip.Color(255, 0, 0), 50); // Red colorWipe(strip.Color(0, 255, 0), 50); // Green colorWipe(strip.Color(0, 0, 255), 50); // Blue colorWipe(strip.Color(219,112,147), 100); // Pink colorWipe(strip.Color(135,206,255), 100); // skyBlue colorWipe(strip.Color(128,158,10), 100); // maize colorWipe(strip.Color(88,2,163), 100); // lavender colorWipe(strip.Color(32,178,170), 100); // seaFoam colorWipe(strip.Color(102,205,0), 100); // spring colorWipe(strip.Color(237,120,6), 100); // orange // theaterChase(strip.Color(127, 127, 127), 200); // White theaterChase(strip.Color(219,112,147), 200); // Pink theaterChase(strip.Color(0, 0, 255), 200); // Blue rainbow(20); rainbowCycle(20); } // Sparkles! void sparks(uint8_t wait) { uint32_t color = 0xFF0000; // Start red strip.show(); // Initialize all pixels to 'off' for(uint16_t i=0; i>= 8; // Next color R->G->B if(!color) color = 0xFF0000; // Reset to red } strip.show(); // Initialize all pixels to 'off' } // Fill the dots one after the other with a color void colorWipe(uint32_t c, uint8_t wait) { for(uint16_t i=0; i