Output Devices

Because I put in a ton more work last week, this week was a lot easier and simpler to finish. Since I was continuing with my project of creating a "Sound Cloud", I worked with leds for my output device. I had a strand of individual digitally-addressable WS2811 LED pixel string lights already so I used them for this week. The goal was to use input from the microphone to modify the brightness and color of the leds.

Getting the LEDs to Work

The first step to getting the sound cloud to work was to figure out how to connect the leds to my prexisting board. The leds had three wires that needed to be connected to my board: a power line with 5V, a ground line, and a data line. I used a jumper wire to connect the power line to the 5V header on my main board, another one to connect the ground line to the ground header, and another final jumper wire to connect the data line to pin 23 to my board.
Once I connected my LEDs to the board, it was time to program them. I used the library manager to find the adafruit neopixel library and downloaded that. Then I found a very simple example program from the library and modified it to work with my setup. This involved only changing the PIN number to 23 instead of the default as well as changing the number of pixels (leds) to 50 instead of 12. Then I uploaded the program and it worked! (insert video and arduino program I used)

Getting Fancy

After proof that the LEDs were working. I decided to try more things out to see what I can do with my led strip. I uploaded another example program that did fancier stuff with the entire strip to see what could be done.

Integration

Once the LEDs were proven to work, it was time to integrate microphone feedback and use that to modify the leds. My first few tries were unsuccessful. I realized quickly that the problem was that I was for looping through the leds in the loop() as well as sampling from the microphone. But a for loop with waits in a loop is a really bad idea so my sampling was very slow. I got rid of that by modifying the entire strip at once with a fill() method or setBrightness() method. Then I could get my microphone input in "realtime".
I decided to use the sample value to modify the brightness of the leds to be one of the first steps to making my "Sound Cloud". I did this by finding a good max_sample value and dividing the values below it into brackets. So the first bracket is sample < max_sample/5, the second bracket is sample < 2*max_sample/5, and onwards in a similar fashion. In each bracket, I set the brightness to the same proportional value. So the first bracket was max_sample/5, so the brightness = brightness/5.

It Works!