from machine import Pin, PWM
from utime import sleep
#Crear objeto
motor = PWM(Pin(21), freq=50) #equivale a 20ms
#FUNCION
def ruta(x):
return int((x-0)*(125-5)/((180-0)+25)) #duty(m) -- 0 a 1023(10BIT)
# Logica
while True:
# 10BIT
for i in range(0,180):
m = ruta(i)
motor.duty(m)
sleep(1)
print(m)