import _thread
from machine import Pin
import time
cero = Pin(15, Pin.OUT)
uno = Pin(2, Pin.OUT)
dos = Pin(0, Pin.OUT)
tres = Pin(4, Pin.OUT)
cuatro = Pin(16, Pin.OUT)
cinco = Pin(17, Pin.OUT)
seis = Pin(5, Pin.OUT)
siete = Pin(18, Pin.OUT)
leds = [cero, uno, dos, tres, cuatro, cinco, seis, siete]
def derecha():
while True:
for elemento in leds [7:3:-1]:
elemento.value(1)
time.sleep(1)
elemento.value(0)
time.sleep(1)
_thread.start_new_thread(derecha,())
def izquierda():
for elemento in leds[0:4:1]:
elemento.value(1)
time.sleep(1)
elemento.value(0)
time.sleep(1)
while True:
izquierda()
time.sleep(1)
if __name__==("__main__"):
main()