Buzzer Unit
Support the following products:
Micropython Example:
import os, sys, io
import M5
from M5 import *
import time
from unit import BuzzerUnit
vib_0 = BuzzerUnit((33, 32))
class BuzzerUnit
Constructors
- class BuzzerUnit(port)
Create an BuzzerUnit object.
- The parameters are:
portIs the pin number of the port
UIFLOW2:
Methods
- BuzzerUnit.once(freq=10, duty=50, duration=50)
Play buzzer once.
- Parameters:
UIFLOW2:
- BuzzerUnit.set_freq(freq: int)
Set the frequency of the buzzer.
- Parameters:
freq (int) – The frequency of the vibration, range is 100 - 10000Hz.
UIFLOW2:
- BuzzerUnit.set_duty(duty: int)
Set the duty cycle of the buzzer.
- Parameters:
duty (int) – The duty cycle of the vibration, range is 0 - 100.
UIFLOW2:
- BuzzerUnit.turn_off()
Turn off the buzzer.
UIFLOW2:
- BuzzerUnit.deint()
Deinitialize the buzzer.
UIFLOW2:
