#BETANZO BOLAÑOS SAMANTHA 602-A
from machine import Pin
import time
led_pins = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
leds = []
for pin in led_pins:
leds.append(Pin(pin, Pin.OUT))
boton_derecha = Pin(17, Pin.IN, Pin.PULL_UP)
boton_izquierda = Pin(16, Pin.IN, Pin.PULL_UP)
posicion = 0
def actualizar_led():
for i in range(10):
leds[i].value(0)
leds[posicion].value(1)
actualizar_led()
while True:
if boton_derecha.value() == 0:
if posicion < 9:
posicion += 1
actualizar_led()
time.sleep(0.2)
if boton_izquierda.value() == 0:
if posicion > 0:
posicion -= 1
actualizar_led()
time.sleep(0.2)