HOME HOME
final project 1

i began by milling a new pcb that i could use for inputs and outputs, with the input being a microphone, and the output being a neopixel led strip. i ended up having to remill this because the first time i milled it and attached the xiao, i ended up shorting the xiao. on the second go, i was sure to tape the parts of the board/xiao that were not in use and i tried to be more precise with my solder.

book1 book1 book1

although not documented, the pcb didn’t work (this is the 3rd pcb i’ve made that doesn’t work).

i still wanted to make progress on using leds as output devices, so i just wired the leds to an arduino nano and fired it up (just connected gnd to gnd, 5v to 3v3, and the led pin to pin 10). this way, i could write most of the programming and test it out before moving to troubleshooting my pcb.

The vision was to test the loop that i want my final project and begin to refine the settings for each section (study, break warning, break, confetti). I think i got closer this week but will only know what i want fully after i have a shell for the box and can see what the different parts look like


        #include 
            #define PIN            10
            #define NUMPIXELS      10
            #define MAX_BRIGHTNESS 255  
            #define MIN_BRIGHTNESS 20   
            #define DELAY_TIME     120  // Delay to control fade speed
            
            Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
            
            void setup() {
              strip.begin();
              strip.setBrightness(MAX_BRIGHTNESS);
              strip.show();
            }
            
            void loop() {
              orangeFadeEffect();
              confettiEffect();
              pinkRedVibeEffect();
              lightsOff();
              delay(1000); 
            }
            
            // Orange fading effect from lower brightness to bright over 30 seconds
            void orangeFadeEffect() {
              for (int i = 0; i < 255; i++) {  
                int brightness = map(i, 0, 255, MIN_BRIGHTNESS, MAX_BRIGHTNESS);  // Map to a range for brightness
            
                for (int j = 0; j < NUMPIXELS; j++) {
                  strip.setPixelColor(j, strip.Color(brightness, (brightness / 2), 0));  
                }
                
                strip.show();
                delay(DELAY_TIME);  // Adjust delay to get around 30 seconds for full fade-in
              }
            }
            
            // Confetti effect for 5 seconds (theater chase)
            void confettiEffect() {
              unsigned long startTime = millis();
              while (millis() - startTime < 5000) {  // Run the effect for 5 seconds
                for (int i = 0; i < NUMPIXELS; i++) {
                  strip.setPixelColor(i, random(0, 255), random(0, 255), random(0, 255));  
                }
                strip.show();
                delay(50);  
              }
            }
            
            // Pink/Red vibe for 10 seconds
            void pinkRedVibeEffect() {
              unsigned long startTime = millis();
              while (millis() - startTime < 10000) {  // Run the effect for 10 seconds
                for (int i = 0; i < NUMPIXELS; i++) {
                  int red = random(150, 255);
                  int green = random(0, 50);
                  int blue = random(50, 150);
                  strip.setPixelColor(i, strip.Color(red, green, blue)); 
                }
                strip.show();
                delay(100); 
              }
            }
            
            // Turn off the lights
            void lightsOff() {
              for (int i = 0; i < NUMPIXELS; i++) {
                strip.setPixelColor(i, 0, 0, 0);  
              }
              strip.show();
            }