How to make the buzzer sound loud with a long tone on PicoBricks?
Hello everyone,
I'm new to Pico and I was trying to make some simple projects with it. I received it today. I could manage to make the leds blink when pressed so that project was fine.
But now I'm trying to use the buzzer on my PicoBricks. It's working but I'm just hearing a click sound as soon as I press the button and after that nothing really. Only when I press the button again it makes the click sound again. How can I make it sound louder with a long tone when I keep the button pressed?
The code I'm using is here:
from machine import Pin
buzzer = Pin(20, Pin.OUT)
button = Pin(10, Pin.IN, Pin.PULL_DOWN)
while True:
if button.value() == 1:
buzzer.value(1)
else:
buzzer.value(0)
Comments
-
I don't know if you want to try MicroBlocks.
In MicroBlocks you have a library for playing notes called Tone 😁
You can easily set the amount of time the note has to play.
0 -
A buzzer creates a tone by vibrating at a certain frequency. So instead of pulling the Pin you have to use PWM and modulate the buzzer with the frequency and duty cycle you want https://micropython-workshop.readthedocs.io/en/latest/pages/shields/buzzer.html
0
Howdy, Stranger!
Categories
- 117 All Categories
- 3 Community
- 3 Hello Maker!
- 102 PicoBricks - Make, Run, Split, Merge
- 1 PicoBricks IDE
- 1 Arduino IDE
- 31 Hardware Support
- 15 PicoBricks Backers Hub
- 49 MicroBlocks Support
- 3 Shipping Support
- 2 MicroPython
- REX - 8 in 1
- Mechanical Parts and Parkour
- REX Main
- Arduino-IDE
- REX - Shipping
- 12 Products & Technology
- 2 Raspberry Pi
- Arduino
- 10 Other