This week in Pcomp we looked into controlling sounds/speakers and servo motors with arduino. The first task in the lab was to control the pitch of a speaker depending on input from a variable resistor. I took the light meter I made last week and after some tweaking installed a speaker on the breadboard to provide an audio indicator along with the succession of lights. The pitch increases as the amount of light hitting the sensor increases. I was very surprised that the addition of the speaker only required a couple lines of code to be functional.
The next task in the audio lab was to have the speaker play a melody. This required a library to be called in the Arduino IDE and the use of some arrays, which I don’t have much experience with. However I followed along with the lab closely and was able to get the melody playing on my arduino. The slight change I made from the lab was to assign different pins because I wanted to keep my light meter operational.
And last up for the audio lab was to build an instrument. I had limited success here. I was able to get responsive tones from a few light sensors, however I also had a persistent buzzing tone that I couldn’t eliminate. I realized that part of this may be due to the fact that I am maintaining my light meter on the same board and that I may have unintentionally introduced some interference or error. I plan to attempt this again with a clean breadboard later this week.
At this point I moved onto the servo lab and ended up successfully including a servo as another responsive element in my light meter.
I’ve been having a good time building around this light meter. I realize it’s fairly basic but I find it helpful to work with something thats somewhat familiar and somewhat new at the same time.