from machine import Pin, ADC, PWM
from utime import sleep, sleep_ms
buzzer=PWM(Pin(13))
do=Pin(15, Pin.IN, Pin.PULL_UP)
re=Pin(2, Pin.IN, Pin.PULL_UP)
mi=Pin(4, Pin.IN, Pin.PULL_UP)
fa=Pin(5, Pin.IN, Pin.PULL_UP)
sol=Pin(18, Pin.IN, Pin.PULL_UP)
la =Pin(19, Pin.IN, Pin.PULL_UP)
si =Pin(21, Pin.IN, Pin.PULL_UP)
do_1 =Pin(22, Pin.IN, Pin.PULL_UP)
while True:
if do.value()==0:
buzzer.freq(261)
buzzer.duty(1023)
elif re.value()==0:
buzzer.freq(293)
buzzer.duty(1023)
elif mi.value()==0:
buzzer.freq(329)
buzzer.duty(1023)
elif fa.value()==0:
buzzer.freq(349)
buzzer.duty(1023)
elif sol.value()==0:
buzzer.freq(392)
buzzer.duty(1023)
elif la.value()==0:
buzzer.freq(440)
buzzer.duty(1023)
elif si.value()==0:
buzzer.freq(493)
buzzer.duty(1023)
elif do_1.value()==0:
buzzer.freq(523)
buzzer.duty(1023)
else:
buzzer.freq(1)
buzzer.duty(0)