Working in loop and taking orders #10954
Replies: 5 comments 2 replies
-
One very well structured way to do that is with asyncio, look here for a good introduction |
Beta Was this translation helpful? Give feedback.
-
Problem with this solution is that it makes other tasks only during "await" command so it's impossible to blink the led and take orders in the same time, without "await". |
Beta Was this translation helpful? Give feedback.
-
Yes, you can blink multiple leds and receive commands, see https://docs.micropython.org/en/latest/library/uasyncio.html. Blocking, threads and asyncio needs a more careful design. Here are some guidelines https://github.com/peterhinch/micropython-async/blob/master/v3/docs/THREADING.md |
Beta Was this translation helpful? Give feedback.
-
As I read there, it manages blocking calls with _thread and as far as I know it's only possible for RPI, because with ESP32 one thread is reserved for FreeRTOS only. |
Beta Was this translation helpful? Give feedback.
-
This is a fairly simple polling framework that can also be used with uasyncio: Curt |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys.
I'm trying to write the program where led will be blinking in infinite loop after pushing the button and I would like my program to be able to take another orders (for example turning devices connected to different pins).
What is the best way to do it? Is it even possible?
Beta Was this translation helpful? Give feedback.
All reactions