Simple Buzzer Help Please :)

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
slast
Posts: 3
Joined: Mon Jan 15, 2018 4:55 am

Simple Buzzer Help Please :)

Post by slast » Mon Jan 15, 2018 5:05 am

Very simple question I know but can anyone help me get a buzzer to play a simple tune.

I have a 12mm piezo buzzer and a pyboard and I'm trying to play a simple tune from the buzzer, ie just a couple of notes. I'm pretty new to coding so have been trying to find a tutorial to follow. So far I've gone through these ones below with no luck.

https://wiki.mchobby.be/index.php?title ... Hack-piezo
http://wiki.micropython.org/Play-Tone
https://learn.sparkfun.com/tutorials/ge ... g-a-buzzer

I can connect the buzzer to a battery and get a click sound and I can generate the same click sound though the USR button but thats about it. Can anyone direct me to a better tutorial or help me figure out how to get this going?:) Also I have another two buzzers that both produces a continuous tune when connected to battery.

Thank you:)

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Simple Buzzer Help Please :)

Post by dhylands » Mon Jan 15, 2018 6:08 am

See this post: viewtopic.php?t=2172

slast
Posts: 3
Joined: Mon Jan 15, 2018 4:55 am

Re: Simple Buzzer Help Please :)

Post by slast » Tue Jan 16, 2018 2:22 am

Thanks for sharing this.

I've tried to follow what you've done but I'm connected an external speaker, not one one the board. I've tried using your code and replacing the pin definition from pyb.Pin.board.BUZZER to pyb.Pin.board.Y1 without much luck:S

slast
Posts: 3
Joined: Mon Jan 15, 2018 4:55 am

Re: Simple Buzzer Help Please :)

Post by slast » Tue Jan 16, 2018 3:00 am

Just got it to work!!! I didn't have the channels, timers and pin correctly labeled first time around. Thank you very much for your help!

Post Reply