from machine import Pin,PWM
from time import sleep
push1=Pin(23,Pin.IN,Pin.PULL_UP)
push2=Pin(21,Pin.IN,Pin.PULL_UP)
push3=Pin(5,Pin.IN,Pin.PULL_UP)
push4=Pin(2,Pin.IN,Pin.PULL_UP)
buzzer = PWM(Pin(14))
while True:
state1=push1.value()
state2=push2.value()
state3=push3.value()
state4=push4.value()
if state1==False:
buzzer.freq(100)
elif state2==False:
buzzer.freq(1000)
elif state3==False:
for i in range(100,1000,200):
buzzer.freq(i)
sleep(0.005)
elif state4==False:
for i in range(500,1000):
buzzer.freq(i)
sleep(0.005)
else:
buzzer.freq(1)