To expand on my switch from the previous assignment, I decided to use one of the more basic codes that we learned in class. Wednesday, in class, was the first time that I have ever coded. After the class ended, I become pretty overwhelmed with all the new content I was learning and couldn’t really wrap my head around how each line of code was working. I asked my friend if he could go over the code with me again so that I made sure how each line worked and how they interacted with one another. The code I have used is, therefore, more simple than the one we inputted in class because I wanted to understand the really simple codes before getting into the more advanced codes (e.g. I didn’t use “bool”, only “int”).
I decided to run probably the most basic lines of code, which is to let the LEDs blink, i.e. one LED would be on initially and when the pedal was pressed, the other would light up but the initial LED would not. When let go, the newly lit LED would go off and the initial LED would light back up.
I connected my wires and LEDs in the way shown in Figure 1 below.
The lines of code that I used are shown here: https://gist.github.com/hyl392/df806c51ac2ae19a9ec0a7939ecb0cd3
The link to my final product, making the LEDs “blink” is here: https://www.youtube.com/watch?v=A-Gl6UceYLs
The improvement and the lines of code are simple, but in terms of its relation to the use of the foot pedal, if the second LED were to be another colour (like in the video above) and were brighter, playing the drums could become almost like a light show. Creating a light show that follows the beat of the drums could be pretty fun! Music festival-worthy, perhaps!