from machine import Pin, PWM
from time import sleep_ms

LED = 25 # For ESP32

pwm_led = PWM(Pin(LED, mode=Pin.OUT)) # Attach PWM object on the LED pin

# Settings
pwm_led.freq(1_000)

while True:
    for duty in range(0,1024):
      print("Duty =", duty)
      pwm_led.duty(duty) # For ESP32
      sleep_ms(5)