I'm attempting to use asyncio as described in the tutorial on Github and the flashing led example runs fine. However as stated once a asycncio.run() is issued no other processing occurs. In my specific application I want 4 DHT22 sensors to be read one per second so every 4 seconds all the readings would be available for the application. I can read the DHT sensors fine in synchronous mode and converted the code to run asynchronous and that works. However the rest of the user interactive code (to handle buttons and other user actions) can never run as stated in the tutorial. Therefore am I correct in assuming I MUST include the user interactive processing code as a task in the uasyncio.run() loop and should it be as async def foo()s or can it be synchronous code that is give processing time by the uasyncio.run() loop?
Regards Denis
Uasyncio basics
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Uasyncio basics
See this doc which describes classes for interfacing switches and pushbuttons. Using these, switch status changes can run callbacks.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.