Пример #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)