Week 2 Li: Multimedia Input/Output

I first had the idea to use the potentiometer as an input and different LEDs as outputs. This worked quite well, so I added a buzzer to it and wrote the program so that the buzzer would have specific frequency as outputs, with the same conditions as the lights. So, different positions of the potentiometer would correspond to a specific tone and light. However, when I tried it out, I realized that one could only play continuous melodies with this method. To fix this, I replaced the potentiometer with four buttons, each of which turned on a lamp and a tone. It took me a long time to make it work, because I forgot to add a final else statement in the code to make everything turn off when there is no button pressed. The final product is a mini-instrument capable of playing very simple melodies such as “Mary’s little lamb”.

using-buttons

using-potentiometer

Leave a Reply

Your email address will not be published. Required fields are marked *