<?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[need help converting text to int (CORE2)]]></title><description><![CDATA[<p dir="auto">how to convert text extracted from a string via ESP NOW.<br />
<img src="/assets/uploads/files/1614535758603-1a40b9f8-a807-4ef2-ad77-33e8720834cb-image.png" alt="0_1614535758163_1a40b9f8-a807-4ef2-ad77-33e8720834cb-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">How to convert X to digital type integer?</p>
<p dir="auto"><img src="/assets/uploads/files/1614535888217-825dc2f1-470a-4490-9d1b-a66aa025e815-image.png" alt="0_1614535888010_825dc2f1-470a-4490-9d1b-a66aa025e815-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I have error messages !</p>
]]></description><link>https://community.m5stack.com/topic/3020/need-help-converting-text-to-int-core2</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Mar 2026 09:27:15 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/3020.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 28 Feb 2021 18:13:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to need help converting text to int (CORE2) on Mon, 15 Mar 2021 16:30:34 GMT]]></title><description><![CDATA[<p dir="auto">There's execute code block also</p>
]]></description><link>https://community.m5stack.com/post/13028</link><guid isPermaLink="true">https://community.m5stack.com/post/13028</guid><dc:creator><![CDATA[Thrasher]]></dc:creator><pubDate>Mon, 15 Mar 2021 16:30:34 GMT</pubDate></item><item><title><![CDATA[Reply to need help converting text to int (CORE2) on Mon, 15 Mar 2021 13:56:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/5685">@arno</a></p>
<p dir="auto">I think your issue is because you are using variable X within the ESP Now Receive Callback to hold the string data coming from the ESP Now transmitter device. Then within the Loop, you are trying to convert it to an integer. Upon program execution, the Python code has X=None, and is trying to convert X (which has no data yet) to an integer, thus throwing the error: can't convert noneType to int.  So you have a few options. These worked for me.</p>
<ol>
<li>
<p dir="auto">Define X within the Setup function like this...<br />
<img src="/assets/uploads/files/1615815691692-screen-shot-2021-03-15-at-9.39.13-am-resized.png" alt="0_1615815666547_Screen Shot 2021-03-15 at 9.39.13 AM.png" class=" img-fluid img-markdown" /></p>
</li>
<li>
<p dir="auto">Redesign your program to perform all the calculations within the Receive Callback function. I actually prefer this option, because it doesn't require a Loop and is therefore non-blocking (no 1 second delay in the Loop). You're just waiting to receive data from ESP Now and then take action on it. However, I'm not sure what the rest of your program is supposed to achieve, so just take this into consideration.<br />
<img src="/assets/uploads/files/1615816029561-screen-shot-2021-03-15-at-9.44.27-am-resized.png" alt="0_1615816004028_Screen Shot 2021-03-15 at 9.44.27 AM.png" class=" img-fluid img-markdown" /></p>
</li>
</ol>
<p dir="auto">For reference, here is my ESP Now transmitter flow. It's an M5StickC with the JoyC Hat. It sends the X position data of the left joystick, mapped from 0 to 180, so it will turn a servo connected to port A on the Core2 (the ESP Now receiver).<br />
<img src="/assets/uploads/files/1615816353852-screen-shot-2021-03-15-at-9.49.55-am-resized.png" alt="0_1615816326750_Screen Shot 2021-03-15 at 9.49.55 AM.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/post/13024</link><guid isPermaLink="true">https://community.m5stack.com/post/13024</guid><dc:creator><![CDATA[world101]]></dc:creator><pubDate>Mon, 15 Mar 2021 13:56:16 GMT</pubDate></item><item><title><![CDATA[Reply to need help converting text to int (CORE2) on Sun, 14 Mar 2021 17:36:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/1795">@thrasher</a> said in <a href="/post/12735">need help converting text to int (CORE2)</a>:</p>
<blockquote>
<p dir="auto">X = int (« x »)</p>
</blockquote>
<p dir="auto">I have variment of help, voci several attempts with the error messages with UiFlow 1.7.3.</p>
<p dir="auto"><img src="/assets/uploads/files/1615742996737-af1d7cc7-db37-4694-8bef-31a105479a0f-image.png" alt="0_1615742996554_af1d7cc7-db37-4694-8bef-31a105479a0f-image.png" class=" img-fluid img-markdown" /> Error : can't convert noneType to int</p>
<p dir="auto"><img src="/assets/uploads/files/1615743084133-9cd8efde-3ef1-4d06-a2bb-a895cffb1d9b-image.png" alt="0_1615743082788_9cd8efde-3ef1-4d06-a2bb-a895cffb1d9b-image.png" class=" img-fluid img-markdown" /> Error : name 'X' isn't defined</p>
<p dir="auto"><img src="/assets/uploads/files/1615743145206-d531ba80-10e2-4344-aa75-383e7304f263-image.png" alt="0_1615743145276_d531ba80-10e2-4344-aa75-383e7304f263-image.png" class=" img-fluid img-markdown" /> Error : can't convert noneType to int</p>
<p dir="auto">How to convert X (ex "7") to 7?</p>
<p dir="auto">Lack of documentation is a real problem</p>
]]></description><link>https://community.m5stack.com/post/13009</link><guid isPermaLink="true">https://community.m5stack.com/post/13009</guid><dc:creator><![CDATA[Arno]]></dc:creator><pubDate>Sun, 14 Mar 2021 17:36:00 GMT</pubDate></item><item><title><![CDATA[Reply to need help converting text to int (CORE2) on Mon, 01 Mar 2021 15:26:11 GMT]]></title><description><![CDATA[<p dir="auto">X = int("x")</p>
]]></description><link>https://community.m5stack.com/post/12735</link><guid isPermaLink="true">https://community.m5stack.com/post/12735</guid><dc:creator><![CDATA[Thrasher]]></dc:creator><pubDate>Mon, 01 Mar 2021 15:26:11 GMT</pubDate></item></channel></rss>