I just installed MicroPython 1.14 and trying to understand non-blocking tasks I ran this example code from MicroPython 1.14 documentation:
Code: Select all
import uasyncio
async def blink(led, period_ms):
while True:
led.on()
await uasyncio.sleep_ms(5)
led.off()
await uasyncio.sleep_ms(period_ms)
async def main(led1, led2):
uasyncio.create_task(blink(led1, 700))
uasyncio.create_task(blink(led2, 400))
await uasyncio.sleep_ms(10_000)
from machine import Pin
uasyncio.run(main(Pin(1), Pin(2)))
Code: Select all
AttributeError: 'module' object has no attribute 'run'
Thanks.