First commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
from machine import PWM, Pin
|
||||
from utime import sleep
|
||||
|
||||
# From https://github.com/udacity/cd13765-deci-emb-sys-l4-term2-project.git
|
||||
|
||||
class Buzzer:
|
||||
def __init__(self, pin):
|
||||
self.pin = pin
|
||||
self.buzzer = PWM(Pin(pin, Pin.OUT))
|
||||
self.buzzer.duty(0)
|
||||
|
||||
def beep_once(self):
|
||||
self.buzzer.freq(1047)
|
||||
self.buzzer.duty(50)
|
||||
sleep(0.2)
|
||||
self.buzzer.duty(0)
|
||||
Reference in New Issue
Block a user