Description
Preamble
In this lab, you’ll make beautiful music using PWM with Arduino and a passive buzzer.
Lab Description
Using the frequency/duration format we saw in the lecture material this week, create a
song. If your code works and plays a tune that isn’t just random and arbitrary values for
frequency and duration, you’ll get full marks. I feel like I’ve worked you all hard enough in
this course, so let’s finish on something fun and easy.
I will give honorable mentions to my favorite songs, and to those who clearly put in a lot of
thought and work.
You don’t have to create your own song from scratch. This would require more musical
theory than I can reasonably expect. There are online resources for this you can discover.
Here is a website with many examples:
The code used here is far more sophisticated than what we saw in class, but the frequencies
and durations are there for you to adapt to your own code.
Requirements
• Your song should be at least 5 seconds in duration and repeat after one second of
silence. Feel free to make it as long and elaborate as you like.
• The output PWM signal should be on Arduino Pin9, just like we saw in the slides. I will
test your program on the very simple buzzer setup from the slides as well (pictured
below).
• Beyond this, that’s it. Implement an example you find online, or, if you’re musically
inclined, translate your own favorite bit of sheet music into a buzzer tune.
Submission
Labs are to be submitted in groups of 1-3! If working in a group, only one person should
submit. Clearly indicate in the submission the names of all group members. Submit a single
source code file under Lab #6 on D2L. I will supply my own pitches.h file. You don’t need
to submit a picture of your circuit.