This is my first time posting to the forum. Over the last couple of months I've become increasingly interested in LED art. I was introduced to Adafruit through a friend who built a pair of NeoPixel LED Goggles and let me wear them at a dance party. After that experience, I purchased the kit and built my own pair. It was my first time soldering small components on a board and my first experience with the Arduino IDE. As a meticulous maker, my first attempt at the project went well, and I was very excited to see the goggles light up after uploading the NeoPixel library (provided):
Code: Select all
// Low power NeoPixel goggles example. Makes a nice blinky display
// with just a few LEDs on at any time.
#include <Adafruit_NeoPixel.h>
#ifdef __AVR_ATtiny85__ // Trinket, Gemma, etc.
#include <avr/power.h>
#endif
#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 = 0xFF0000; // Start red
uint32_t prevTime;
void setup() {
#ifdef __AVR_ATtiny85__ // Trinket, Gemma, etc.
if(F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
pixels.begin();
pixels.setBrightness(85); // 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(32);
pixels.setPixelColor(i, color);
pixels.show();
delay(10);
pixels.setPixelColor(i, 0);
break;
case 1: // Spinny wheels (8 LEDs on at a time)
for(i=0; i<16; i++) {
uint32_t c = 0;
if(((offset + i) & 7) < 2) c = color; // 4 pixels on...
pixels.setPixelColor( i, c); // First eye
pixels.setPixelColor(31-i, c); // Second eye (flipped)
}
pixels.show();
offset++;
delay(50);
break;
}
t = millis();
if((t - prevTime) > 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 = 0xFF0000; // Reset to red
}
for(i=0; i<32; i++) pixels.setPixelColor(i, );
prevTime = t;
}
}
Here are some of the modifications I'm interested in:
1. change the color cycle of "random sparks" (case 0) and "spinny wheels" (case 1) from standard RGB to a yellow-orange-purple cycle
2. change the time interval between case 0 and case 1 to 30 seconds
3. increase the LED brightness to 2/3 the power of the current LED brightness
4. change the rotation of the second NeoPixel ring (counter clockwise) to match the rotation of the first ring (clockwise movement on both)
*Please note: I have a beginners understanding of programming, however I am confident in my ability to piece this puzzle together.
*Second note: I have researched the adafruit forums and backtracked through NeoPixel tutorials but found nothing directly helpful
*Resources utilized: Adafruit NeoPixel Überguide, RainbowCycle - Adafruit Learning System, Multi-tasking the Arduino (Part 3)
Any advice is appreciated, I'm very excited and grateful for this learning experience!