from machine import Pin, PWM
import time
servo1=PWM(Pin(15))
servo1.freq(50) 4 Frecuencia 50 hertz.
boton0=Pin(17,Pin.IN,Pin.PULL_DOWN)
boton90=Pin(18,Pin.IN,Pin.PULL_DOWN)
boton180=Pin(16,Pin.IN,Pin.PULL_DOWN)
#Super lazo
while 1:
if boton0.value()==1:
servo1.duty_u16(1638) #2.5 %
time.sleep(0.5)
if boton90.value()==1:
servo1.duty_u16(4915) #7.5 %
time.sleep(0.5)
if boton180.value()==1:
servo1.duty_u16(8150) #12.5 %
time.sleep(0.5)