mqtt and button on atomS3
-
Hi there,
i have a problem with the button click event. I want to subscribe and publish to different mqtt topics and use the display button of the atomS3 to publish messages. The button works till i include the "mqtt apply for messaging" block. When i include that block the button event is not triggered anymore. Without the mqtt block i cant recive mqtt-messages. Here a short example:
image url )What i have to do to get it work? Thanks for the help.
-
Hello @alwa123
it looks like the MQTT library used is called
umqtt
. It has two methods to wait/check for server messages:wait_msg()
andcheck_msg()
. The former is blocking, the latter is non blocking. See here - section API reference.The block
MQTT apply for messaging
createsmqtt_client.wait_msg()
, the blocking variant. In order for the button events to work the non blocking variant should be used inloop()
.This can be done with an
Execute code
block containingmqtt_client.check_msg()
. See below.@m5stack : could you please add an MQTT block for the non blocking variant?
Thanks
Felix -
Great help, that did the job. Very thanks