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

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!