from machine import Pin, PWM
from utime import sleep
print("Play Buzzer ESP32!")
#frekuensi untuk tone 440 494 523 587 659 698 784
#ledpin = Pin(2, Pin.OUT)
buzzerpin=Pin(15, Pin.OUT)
buzzer = PWM(buzzerpin)
while True:
buzzer.freq(440)
buzzer.duty(512)
sleep(0.5)
buzzer.duty(0)
sleep(0.5)