Menu Close

to-day

Python
#copy this
from machine import Pin, PWM
from utime import sleep
banana = Pin(1, Pin.IN, Pin.PULL_UP)#*ummmmmmmmmmmmmmmmmmmmmmmmmmmmmm
led = Pin(28, Pin.OUT)
buzzer = PWM(Pin(22))
buzzer.freq(1000)
while True:
    print(banana.value())
    if not banana.value():
        led.on()
        buzzer.duty_u16(1000000)
        print("bananas!")
        sleep(0.5)
    else:
        led.off()
        buzzer.duty_u16(0)