While my 3D print was still going on, which took around 10 hours, I soldered the pin headers for the sound sensor. Once the print was done, I began to move parts onto the build. I used adhesive pads to place the Arduino and sound sensor on it, and used the premade breadboard adhesive to each piece securely. I connected the ground, 5V, and digital pins from the sound sensor to the Arduino first. This was because there were less wires than the LED strips, and that it would be easier to get these plugged in first. Then, I cut the LED strips to have 10 LEDs each and soldered 3 8-inch jumper wires to the ends of each strip. These signals would give the 5V, ground, and digital signal to the Arduino microcontroller, so that I could control the output with the FastLED library. I used craft wire to bundle up each trio of wires for the LED strips to keep the back of the design more organized. I threaded the wires through the opening on the bottom of the 3D print and tested the LED strip before sticking it on the front. This was so I could resolder them easier if needed afterwards. All of the strips ended up working without having to be soldered again, which was very nice. Then, I placed a capacitor on the breadboard to try and help reduce flickering from the LED strips. By this point, everything was hooked up correctly, and it was time to code these parts together.
As mentioned before, I used the FastLED Arduino library to help me interface with the LED Strips. For each pin used, I defined each pin number used at the top of my code. I also defined constants such as how many LED strips I used, and how many LEDs were on each strip. I had to specify the brightness, color order, and type of LED strip to set it up correctly with FastLED. This library had a function to add LEDs by defining the type, pin, and color order. I also had to use a function named setBrightness with the brightness constant that I defined. After this, I had to set a pinMode up for the digital pin of the sound sensor so the input could be read during the loop of the code. This was all done in the setup() function for Arduino, which runs once. In the loop, I first initialized an integer named gate that would read the input of my digital pin on the sound sensor. This would return a 1 or 0 depending on if sound was being picked up or not, respectively. Then, I added an integer called hue that would repeatedly increment between the values 0 through 254 to change the colors of the reacted LEDs. I also added a conditional check so I could modify how fast the change in hues was over time. Next, I added some if else statements to check when the gate value was 1 or 0. If sound was detected, the LED strips would increase the number of changing colors by 2 for every strip. If sound wasn't detected, the LED strips would decrease the changing colors by one. I added two functions at the bottom of my code to help me display the LEDs. setWhite() was made to make all of the LED strips white, acting as a background. Then, I made the other function called setRainbowWithWhite(). This would call setWhite() from within itself, then write over the existing LED’s by defining a set amount to make the rainbow colors. I had an array called rainbowNum to keep track of how many LEDs in each strip should be one of the changing colors at any given time. At the bottom of my main loop, I added the line FastLED.show(), which displayed every LED that I set up at the start of my code. This wrapped most of my code for the sound responsive LED strips, but I plan on making more patterns for this project in the future, since it allows for a lot to be done with the LED strips.