Does MicroPython support asyncio on ESP32?

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
User avatar
liudr
Posts: 145
Joined: Tue Oct 17, 2017 5:18 am

Does MicroPython support asyncio on ESP32?

Post by liudr » Sun Oct 06, 2019 4:13 pm

I'm considering porting the azure python sdk (preview) to ESP32 but the first thing I saw in the code was this asyncio module that supports concurrency. Is this currently supported in MicroPython for ESP32? How well is it support, if I may ask? Thanks.

User avatar
pythoncoder
Posts: 3659
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Does MicroPython support asyncio on ESP32?

Post by pythoncoder » Sun Oct 06, 2019 4:58 pm

The MicroPython implementation is uasyncio and it works well on ESP32. There is information about it here including a tutorial.
tl;dr It can be installed using upip.
Peter Hinch

User avatar
liudr
Posts: 145
Joined: Tue Oct 17, 2017 5:18 am

Re: Does MicroPython support asyncio on ESP32?

Post by liudr » Sun Oct 06, 2019 5:31 pm

pythoncoder wrote:
Sun Oct 06, 2019 4:58 pm
The MicroPython implementation is uasyncio and it works well on ESP32. There is information about it here including a tutorial.
tl;dr It can be installed using upip.
Thanks pythoncoder, as always. I've not used MP for a while. I would humbly ask for a pointer to use upip.py. Do I just place it in my dev board , import it and call upip.install('uasyncio')?

User avatar
pythoncoder
Posts: 3659
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Does MicroPython support asyncio on ESP32?

Post by pythoncoder » Sun Oct 06, 2019 5:38 pm

The magic words, as you'd find in the tutorial I referenced, are

Code: Select all

import upip
upip.install('micropython-uasyncio')
If the import fails because upip isn't already installed you need to copy upip.py and upip_utarfile.py from the MicroPython tools directory to your target.
Peter Hinch

Post Reply