V2
Code: Select all
loop = uasyncio.get_event_loop()
loop.create_task(lst_service())
loop.create_task(ble_service())
try:
loop.run_forever()
except Exception as e:
print("error: "+str(e))
Code: Select all
async def main():
tasks = (uart_xbee_service, uart_gps_service)
try:
res = await uasyncio.funcs.gather(*tasks, return_exceptions=True)
except uasyncio.CancelledError:
print("Cancelled.")
except Exception as e:
print("error")
try:
uasyncio.run(main())
except Exception as e: # not working ?
print("error: "+str(e))
Thanks.