I want to use REPL while using uasyncio
Posted: Wed Jun 06, 2018 5:03 am
When using uasyncio, the program is looping and cannot use REPL.Is there a way to achieve both at the same time?
Here is my code:
I try to use REPL while using _thread, It is working. But this article says “Threads Are Bad”. what should I do?
Here is my code:
Code: Select all
import uasyncio as asyncio
async def blink1():
bled=LED(4)
while True:
bled.toggle()
await asyncio.sleep_ms(1000)
async def blink2():
gled = LED(2)
while True:
gled.toggle()
await asyncio.sleep_ms(2000)
loop = asyncio.get_event_loop()
loop.create_task(blink1())
loop.create_task(blink2())
loop.run_forever()