コード例 #1
0
def noTone(pin):
    GPIO.PWM(pin).stop()
コード例 #2
0
def tone(pin, frequency, duration=None):
    p = GPIO.PWM(pin, frequency)
    p.start(50)
    if duration is not None and duration > 0:
        threading.Timer(duration, lambda *args, **kwargs: p.stop()).start()