from machine import Pin, PWM import time _init() tones = { 'c': 262, 'd': 294, 'e': 330, 'f': 349, 'g': 392, 'a': 440, 'b': 494, 'C': 523 } speaker = PWM(Pin(15, Pin.OUT)) speaker.duty(512) speaker.freq(tones['c']) time.sleep(1) speaker.freq(tones['f']) time.sleep(1) speaker.freq(tones['b']) time.sleep(1) speaker.duty(0)