from machine import Pin, PWM
import time
BUZZER_PIN = 3
buzzer = PWM(Pin(BUZZER_PIN, Pin.OUT))
def playNote(frequency, duration, pause) :
global buzzer
buzzer.duty_u16(5000)
buzzer.freq(frequency)
time.sleep(duration)
buzzer.duty_u16(0)
time.sleep(pause)
## notes = [440, 494, 523, 587, 659, 698, 784]
notes = [261, 261, 293, 261, 349, 329,
261, 261, 293, 261, 392, 349,
261, 261, 523, 440, 349, 329, 293,
466, 466, 440, 349, 392, 349]
for note in notes :
playNote(note, 0.2, 0.01)