Buzzer integration details
-
Hello,
I am trying to integrate a buzzer.
Can anyone advice, please, how is the best way to stop a started buzz ?
To start it, I use:
dac_tone.tone(1000, 0) # set tone output to 1kHzI do not know how to stop it . Also, it will be great to make a kind of intermitent beeps. Is this done by starting and stopping the buzzer ?
Thank you very much for your support,
-
@ClementN The PR is here: https://github.com/pycom/pycom-micropython-sigfox/pull/65
It shows also the minor change to the file pybdac.c and what you can expect from the change (which is just four different levels).
-
Thank you, @robert-hh looking forward for the workaround on parameter 2
-
Thank you. @livius I will take a closer look into pwm
-
@ClementN You can switch off the tone with dac.deinit(). Switching it back on requires:
dac.init() dac.tone(1000,0)
The second parameter does not seem to change anything. The frequency is a little bit off. Setting a value of 1000 results in a frequency of 1024 Hz.
P.S.: Looking at the code in mods/pybdac.c, the second parameter is indeed ignored.
P.S.2: I added the few lines to handle the second parameter and will make a PR later on. The documentation must be adapted too.
-
@ClementN
if i understand corectly you have passive buzzer and you try to drive it with song.
you use dac for this?
I use pwm and this work like a charm :)