Pins
Negative (Black) pin
Positive (Red) pin
Attributes
Buzzer operation mode: “smooth” or “accurate”
Volume (loudness) of the sound, between “0.01” and “1.0”
Operation modes
The buzzer can operate in two modes: “smooth” (the default) and “accurate”. Smooth mode sounds better and is suitable for simple, single-frequency tones. Use it when playing a melody or playing tones with Arduino’stone() function. Complex and polyphonic sounds may not play correctly (or not play at all) in smooth mode.
Accurate mode should be used when you need to play complex sounds. It will accurately play the sound you feed in. However, it’ll add audible click noises to your sound. These noises are due to fluctuations in the simulation speed - it’s not always able to provide the complete sound buffer in real time.
Arduino example
Connect pin 1 of the buzzer to Arduino GND pin, and pin 2 of the buzzer to Arduino pin 8. Then use thetone() function to play a sound:
Simulator examples
- Simon game - A memory game with 4 push buttons
- Diatonic piano - An 8-note piano, use keys 1-8 to press the buttons and play the notes.
- Alarm clock - Uses the buzzer to play the alarm sound