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!).

Save this program as “buzzer_1”.

Activity 2 – Metronome

Write a program that exactly mimics this metronome:

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”.