#Nombre: HERNANDEZ DE LOS ANGELES BRYAN GREGORY
#Grupo: 602-A
from machine import Pin
import time
led_pins = [
Pin(0, Pin.OUT),
Pin(1, Pin.OUT),
Pin(2, Pin.OUT),
Pin(3, Pin.OUT),
Pin(4, Pin.OUT),
Pin(5, Pin.OUT),
Pin(6, Pin.OUT),
Pin(7, Pin.OUT),
Pin(8, Pin.OUT),
Pin(9, Pin.OUT)
]
btn_der = Pin(17, Pin.IN, Pin.PULL_UP)
btn_izq = Pin(16, Pin.IN, Pin.PULL_UP)
posicion = 0
def actualizar():
for i in range(10):
led_pins[i].value(1 if i == posicion else 0)
for led in led_pins:
led.value(0)
time.sleep_ms(100)
actualizar()
while True:
if btn_der.value() == 0:
if posicion < 9:
posicion += 1
actualizar()
time.sleep_ms(500)
if btn_izq.value() == 0:
if posicion > 0:
posicion -= 1
actualizar()
time.sleep_ms(500)
time.sleep_ms(10)