from machine import Pin, PWM
from time import sleep
pwmled = PWM(Pin(0))
pwmled.freq(1000) #1000 hz
while True:
for duty in range(32000):
pwmled.duty_u16(duty)
sleep(0.0001)
for duty in range(65025, 0, -1):
pwmled.duty_u16(duty)
sleep(0.0001)