Пример #1
0
def createpulse(pw, dutycycle, init):
    if init == 1:
        buzzer.on(pin)
        time.sleep(dutycycle * pw)
        buzzer.off(pin)
        time.sleep((1 - dutycycle) * pw)
    else:
        buzzer.off(pin)
        time.sleep((1 - dutycycle) * pw)
        buzzer.on(pin)
        time.sleep(dutycycle * pw)
Пример #2
0
def create(pw, dutycycle, init):
    global off
    if init == 1:
        while True and off == False:
            buzzer.on(pin)
            time.sleep(dutycycle * pw)
            buzzer.off(pin)
            time.sleep((1 - dutycycle) * pw)
    else:
        while True and off == False:
            buzzer.off(pin)
            time.sleep((1 - dutycycle) * pw)
            buzzer.on(pin)
            time.sleep(dutycycle * pw)
    off = False
Пример #3
0
def sos():
    for i in range(1):
        for i in range(1, 4):
            LED.red()
            buzzer.on()
            time.sleep(0.2)
            LED.off()
            buzzer.off()
            time.sleep(0.2)
        for i in range(1, 4):
            LED.red()
            buzzer.on()
            time.sleep(0.5)
            LED.off()
            buzzer.off()
            time.sleep(0.5)
        for i in range(1, 4):
            LED.red()
            buzzer.on()
            time.sleep(0.2)
            LED.off()
            buzzer.off()
            time.sleep(0.2)
Пример #4
0
from machine import Pin
import display
import buzzer
import usb

Pin(17, Pin.OUT).value(1)
Pin(2, Pin.OUT).value(1)
Pin(15, Pin.OUT).value(1)
Pin(12, Pin.OUT).value(1)
display.clear()
buzzer.off()
usb.off()