from machine import Pin,PWM
from time import sleep

buzzer = PWM(Pin(18,Pin.OUT),freq = 500)

buzzer.duty(100)
sleep(1)
buzzer.duty(0)