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 elementos in leds[7:3:-1]:
elementos.value(1)
time.sleep(1)
elementos.value(0)
time.sleep(1)
print("Derecha")
_thread.start_new_thread(derecha,())
def izquierda():
while True:
for elementos in leds[0:4:1]:
elementos.value(1)
time.sleep(0.2)
elementos.value(0)
time.sleep(0.2)
print("Izquierda")
while True:
izquierda()
time.sleep(1)
if __name__ == ("__main__"):
main()