3 · Outputs & actuators
Buzzer: playing notes
Intermediate15 min
Goal
Play a scale with tone() on pin 8.
Why it matters
Frequency sets the pitch: your first look at periodic signals.
Steps
- 01Add a buzzer on pin 8.
- 02Declare an array of frequencies (262, 294, 330, 349, 392…).
- 03Play them with tone(8, f, 300) inside a for loop.
- 04Finish with noTone(8).
This tutorial runs inside the Circuitly simulator: your wiring and your code are checked automatically at every step.