#Nombre: Flores Canseco Joe Anthony
#Grupo: 602-A
from machine import Pin
import time
leds= [
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)
]
boton_der = Pin(16, Pin.IN, Pin.PULL_UP) #para bajar
boton_izq = Pin(17, Pin.IN, Pin.PULL_UP) #para subir
posicion = 0
def actualizar_leds():
for i in range(len(leds)):
if i == posicion:
leds[i].value(1)
else:
leds[i].value(0)
actualizar_leds()
while True:
if boton_der.value() == 0:
if posicion < 9:
posicion += 1
actualizar_leds()
time.sleep(0.2)
if boton_izq.value() == 0:
if posicion > 0:
posicion -= 1
actualizar_leds()
time.sleep(0.2)