micropython-lib/uasyncio.core/example_call_soon.py

17 wiersze
274 B
Python

import uasyncio.core as asyncio
import time
import logging
logging.basicConfig(level=logging.DEBUG)
#asyncio.set_debug(True)
def cb():
print("callback")
time.sleep(0.5)
loop.call_soon(cb)
loop = asyncio.get_event_loop()
loop.call_soon(cb)
loop.run_forever()