Play a melody on a buzzer
Pitches and lengths live in arrays and are played in order.
Actuator
buzzerPWM
Why this support circuit is added
Passive buzzer driven by tone(). A series resistor keeps it inside the MCU pin limit (20 mA); for more volume drive it through a transistor (see load_mosfet).
Grounded in the catalog and golden patterns (real open-source circuits). Every auto-inserted part comes with a reason.
Using this part in a project adds the circuit below, each element with its reason.
Limits MCU pin current.
Run them in the browser, no login needed.
Pitches and lengths live in arrays and are played in order.
Maps the A0 reading straight onto an audible frequency.
Reads several inputs and sounds the note belonging to whichever is pressed.
tone() drives one pin at a time; noTone() frees it for the next.
An ultrasonic range finder beeps at shorter intervals as something gets closer, and lights an LED inside 30 cm.
Pressing the button turns the NeoPixel ring blue and plays two tones.