Buzzer Activities

Activity 1 – Buzzer Intro

Refer to this page for this activity. Do NOT copy and paste the code — type it in (or you won’t learn anything…).

Note that the 100 Ω resistor is optional. You can leave it out for simplicity (and extra volume!).

Once you have the basic buzzer program working, research for loops  and modify the program so it loops from 100 Hz to 10,000 Hz in 20 Hz increments and then down again, infinitely.

Save this program as “buzzer_1”.

Activity 2 – Metronome

Write a program that exactly mimics this metronome:

https://www.youtube.com/watch?v=-sZD0Avi8Qs

You will likely want to refer to the Tone reference page for assistance. (Read the syntax carefully for an important tip!)

Note: for this assignment I want you to use the tone() function using this syntax:

tone(pin, frequency, duration)

When I see you for marking be sure you can explain the “math” involved in setting the metronome frequency.

Save as “metronome”.

Activity 3 – Star Wars

This activity also uses two LEDs.  Have fun with it! [Source]

Save as “star_wars”.

Activity 4 – Twinkle Twinkle

Using the Star Wars program as a starting point, adapt it to play Twinkle Twinkle Little Star.

You can delete any references to the LEDs.

Save as “twinkle”.