<?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[UART Equal function always returns false]]></title><description><![CDATA[<p dir="auto">For context, I am trying to adapt a Marlin 3D printer smart screen by connecting it to M5Station Port.C1 and the UART response I am expecting (and that is being sent) is "M105". However when I compare the UART variable (which is the decoded UART response) to the code being sent "M105" it always returns false regardless.<br />
Here is the snippet of code if it helps to diagnose:<br />
uart1 = machine.UART(1, tx=14, rx=13)<br />
uart1.init(115200, bits=8, parity=None, stop=1)</p>
<p dir="auto">while True:<br />
if uart1.any():<br />
UART = str((uart1.readline()).decode())<br />
if UART == 'M105':  #This erroneously returns false regardless<br />
pass<br />
wait_ms(2)</p>
]]></description><link>https://community.m5stack.com/topic/5919/uart-equal-function-always-returns-false</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Mar 2026 16:08:26 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/5919.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 28 Dec 2023 05:59:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to UART Equal function always returns false on Thu, 28 Dec 2023 20:38:20 GMT]]></title><description><![CDATA[<p dir="auto">Thank you for the reply, but I have already thought of that. the "decode" block removes everything other than the message (b'M105'\n -&gt; M105)</p>
]]></description><link>https://community.m5stack.com/post/23166</link><guid isPermaLink="true">https://community.m5stack.com/post/23166</guid><dc:creator><![CDATA[HWTaro9]]></dc:creator><pubDate>Thu, 28 Dec 2023 20:38:20 GMT</pubDate></item><item><title><![CDATA[Reply to UART Equal function always returns false on Thu, 28 Dec 2023 09:04:55 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/11558">@HWTaro9</a></p>
<p dir="auto">if I am not mistaken <code>readline()</code> returns the newline <code>\n</code> character at the end. This could be the reason for the comparison to return <code>false</code>.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/23162</link><guid isPermaLink="true">https://community.m5stack.com/post/23162</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Thu, 28 Dec 2023 09:04:55 GMT</pubDate></item></channel></rss>