import machine
import time
from machine import Pin,PWM
btnRojo = Pin(12,Pin.IN,Pin.PULL_UP)
btnVerde = Pin(13,Pin.IN,Pin.PULL_UP)
btnAmarillo = Pin(14,Pin.IN,Pin.PULL_UP)
pwm = PWM(Pin(2,Pin.OUT))
pwm.freq(50)
while True:
#0 grados
if not btnRojo.value():
pwm.duty(25)
time.sleep_ms(3)
#180 grados
elif not btnVerde.value():
pwm.duty(125)
time.sleep_ms(3)
#90 grados
elif not btnAmarillo.value():
pwm.duty(75)
time.sleep_ms(3)