from time import sleep
from machine import Pin
import uasyncio
sleep(0.1) # Wait for USB to become ready
led_1 = Pin(4, Pin.OUT)
led_2 = Pin(2, Pin.OUT)
async def tarea(led, tiempo):
while True:
led.value(1)
await uasyncio.sleep(tiempo) # Encendido durante la mitad del periodo
led.value(0)
await uasyncio.sleep(tiempo)
async def main():
uasyncio.create_task(tarea(led_1, .5))
uasyncio.create_task(tarea(led_2, 2))
while True:
await uasyncio.sleep(1)
uasyncio.run(main())