from machine import Pin, PWM
from utime import sleep
Freq = 5.000
led = PWM(pin(21), Freq)
IN1 = Pin (5, Pin.Out)
IN2 = Pin (18, Pin.Out)
while True:
For duty_cycle in range(0,1024):
IN1.On()
IN2.Of()
led.duty (duty_cycle)
sleep(0.005)
for duty_cycle in range (1024,0):
led.duty(duty_cycle)
sleep(0.005)