<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[mqtt and button on atomS3]]></title><description><![CDATA[<p dir="auto">Hi there,<br />
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:<br />
image url<img src="/assets/uploads/files/1701551172561-screenshot_20231202_220057_samsung-internet-resized.jpg" alt="0_1701551167453_Screenshot_20231202_220057_Samsung Internet.jpg" class=" img-fluid img-markdown" /> )</p>
<p dir="auto">What i have to do to get it work? Thanks for the help.</p>
]]></description><link>https://community.m5stack.com/topic/5862/mqtt-and-button-on-atoms3</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 22:36:12 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/5862.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 02 Dec 2023 21:08:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to mqtt and button on atomS3 on Sun, 03 Dec 2023 20:04:11 GMT]]></title><description><![CDATA[<p dir="auto">Great help, that did the job. Very thanks</p>
]]></description><link>https://community.m5stack.com/post/22954</link><guid isPermaLink="true">https://community.m5stack.com/post/22954</guid><dc:creator><![CDATA[alwa123]]></dc:creator><pubDate>Sun, 03 Dec 2023 20:04:11 GMT</pubDate></item><item><title><![CDATA[Reply to mqtt and button on atomS3 on Sun, 03 Dec 2023 18:20:11 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/alwa123" aria-label="Profile: alwa123">@<bdi>alwa123</bdi></a></p>
<p dir="auto">it looks like the MQTT library used is called <code>umqtt</code>. It has two methods to wait/check for server messages: <code>wait_msg()</code> and <code>check_msg()</code>. The former is blocking, the latter is non blocking. See <a href="https://github.com/micropython/micropython-lib/blob/master/micropython/umqtt.simple/README.rst" target="_blank" rel="noopener noreferrer nofollow ugc">here</a> - section API reference.</p>
<p dir="auto">The block <code>MQTT apply for messaging</code> creates <code>mqtt_client.wait_msg()</code>, the blocking variant. In order for the button events to work the non blocking variant should be used in <code>loop()</code>.</p>
<p dir="auto">This can be done with an <code>Execute code</code> block containing <code>mqtt_client.check_msg()</code>. See below.</p>
<p dir="auto"><img src="/assets/uploads/files/1701627234412-uiflow2_mqtt_check_msg_20231203.png" alt="0_1701627232971_UIFlow2_MQTT_check_msg_20231203.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/m5stack" aria-label="Profile: m5stack">@<bdi>m5stack</bdi></a> : could you please add an MQTT block for the non blocking variant?</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/22949</link><guid isPermaLink="true">https://community.m5stack.com/post/22949</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Sun, 03 Dec 2023 18:20:11 GMT</pubDate></item></channel></rss>