cable Wire buzzers
1. Connect the short (negative) leg to GND.
2. Connect the long (positive) leg to a GP pin.
3. A + symbol is sometimes used to show the positive leg.
# Import the Speaker component
from picozero import Speaker
from time import sleep
# Set up the buzzer with correct pin number
speaker = Speaker(5)
# Control the buzzer
speaker.play('c4') # play middle c for 1s
sleep(1) # speaker off for 1s
speaker.play('c4') # play middle c for 1s
bug_report My buzzer doesn't play a sound
- Check the long (positive) leg is connected to GP5.
- Check your connections.
- Check the pin numbers in your code.