Skip to content
Discussion options

You must be logged in to vote

Hi, yues concurrency in embedded code can be tricky to get working!

Just for a start, personally I try to avoid threads in micropython. Keeping objects in sync between threads can have a fair bit of complexity; and it's worth nothing that the rp2 only support 1 extra thread as it's implemented as code running on the second core.
Once using asyncio for an application (which I always use) I find it's best to try to keep everything in async unless its timing is particularly critical at which point I'll add Timer exceptions for time critical stuff.
Something that might be worth looking at are these couple of example asyncio pushbutton reading classes, both with debouncing:

Replies: 3 comments 6 replies

Comment options

andrewleech
Sep 7, 2023
Collaborator Sponsor

You must be logged in to vote
2 replies
@peterhinch
Comment options

@ropellanda
Comment options

Answer selected by ropellanda
Comment options

You must be logged in to vote
2 replies
@ropellanda
Comment options

@jimmo
Comment options

Comment options

You must be logged in to vote
2 replies
@billbreit
Comment options

@ropellanda
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants