Replies: 1 comment 1 reply
-
Sharing data between threads is difficult - see this doc. The solution which avoids tackling that complexity is to use asyncio - see docs and tutorial. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm trying to control pixel led strip from MQTT. It works fine as long as it's just switch on and off, but if I use thread to animate leds I just can't stop it. My full code is available here : https://github.com/Pilou44/mqttSwitch/blob/main/pico/pico.py
Here is my loop for MQTT reading messages :
And my LED control functions:
On executing, command to switch on works, and I keep seeing message
Loop running
fromrun
function. But no other MQTT messages are received. If I don't start thethread_loop
then I can start and stop leds as long as I want.Does anyone see what the problem is ?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions