Hazardous Waste Material – 5

Task 5:

5 – You might want to play a song of triumph.

The video can be found here

This was super hard for me. I didn’t want to play a song that was already pre-programmed and ready to copy-paste, so I started off with looking up the frequencies of the notes I wanted to play:

In 4/4 time, so that mean's they're all quarter notes.
In 4/4 time, so that mean’s they’re all quarter notes.

This is the chorus of “Firestone” by Kygo. It was hard for me to hear the proper rhythm of the original song, so I just made them all quarter notes. Then, I looked up the frequencies of each note and defined each note with the appropriate frequency:

Frequency Code

int melody[] is the order in which I wanted the notes to play. int tempo[] is the beat at which I wanted each note to play. I simplified it and made it 4/4 with all quarter notes.


I set the speaker to pin 6, and created a function called sing(), which went in the while loop after the ball was dropped.

The code for “sing()” was found using a website that showed how to create the Super Mario Bros. Theme Song. Other than the actual melody that was played, I used the same structure as the code on this website.

I also set the LED on pin 13 to light up at the beat of the song.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s