from machine import Pin, PWM
import utime, time
button1 = Pin(10,Pin.IN,Pin.PULL_UP)
button2 = Pin(11,Pin.IN,Pin.PULL_UP)
button3 = Pin(12,Pin.IN,Pin.PULL_UP)
button4 = Pin(13,Pin.IN,Pin.PULL_UP)
buzzer = PWM(Pin(21))
buzzer.duty_u16(0)
while True:
if button1.value()==0:
buzzer.freq(261)
buzzer.duty_u16(261)
utime.sleep(.5)
buzzer.duty_u16(0)
elif button2.value()==0:
buzzer.freq(293)
buzzer.duty_u16(293)
utime.sleep(.5)
buzzer.duty_u16(0)
elif button3.value()==0:
buzzer.freq(329)
buzzer.duty_u16(329)
utime.sleep(.5)
buzzer.duty_u16(0)
elif button4.value()==0:
buzzer.freq(349)
buzzer.duty_u16(349)
utime.sleep(.5)
buzzer.duty_u16(0)