buzzer
– buzzer control module
The actual name of the module can be buzz_wgen
or buzz_nogen
depending on the type of the buzzer installed.
It is not recommended to create an instance of this class manually. An instance has already been created in the [RFID Utils](#mod_rfid_utils) module. It can be imported with the following snippet:
try:
from rfid_utils import BUZZ
except Exception:
print('Sorry, no buzzer on this board')
Classes
- class buzzer.Buzzer(pin)
pin
is the number of the GPIO with the buzzer.- on()
Switch the buzzer on. The
buzz_nogen
module provides an optional parameterfreq
with the default value of 3200
- off()
Switch the buzzer off.
- beeps(time_ms=50)
Switch the buzzer on for the
time_ms
period (in milliseconds). This is not a coroutine (blocks fortime_ms
milliseconds).
- beep(time_ms=50)
- Async
Switch the buzzer on for the
time_ms
period (in milliseconds). This is a coroutine.
- property enabled
Returns
True
if the buzzer is currently on,False
if it is off.