<?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[&quot;Can´t convert NoneType to int&quot; issue]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I am working on a simple program.</p>
<p dir="auto">I receive a value between 0 and 1000 by MQTT and convert it to a digital value from 0 to 255.<br />
Then I want to put it on the DAC channel 0.</p>
<p dir="auto">But if I want to proceed with the digital value within the main loop I get the error "Can´t convert NoneType to int".</p>
<p dir="auto"><img src="/assets/uploads/files/1704356412472-8076330c-0e14-4cbd-9c91-211de1ce1a02-image.png" alt="0_1704356408997_8076330c-0e14-4cbd-9c91-211de1ce1a02-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I understand that this is a NoneType, which can´t convert into an integer, but I need to work with the digital value in the main loop, because I have to do some calculations (filtering), which is not possible in the MQTT function.</p>
<p dir="auto">How can I solve this issue?</p>
<p dir="auto"><img src="/assets/uploads/files/1704355634408-a5b77d31-9fea-4870-a52e-e88a63c1765a-image-resized.png" alt="0_1704355631045_a5b77d31-9fea-4870-a52e-e88a63c1765a-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/topic/5940/can-t-convert-nonetype-to-int-issue</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 23:34:27 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/5940.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 04 Jan 2024 08:20:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to &quot;Can´t convert NoneType to int&quot; issue on Thu, 04 Jan 2024 09:59:42 GMT]]></title><description><![CDATA[<p dir="auto">Are you using a “convert to int” block to convert the value being sent to the dac?</p>
]]></description><link>https://community.m5stack.com/post/23226</link><guid isPermaLink="true">https://community.m5stack.com/post/23226</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Thu, 04 Jan 2024 09:59:42 GMT</pubDate></item><item><title><![CDATA[Reply to &quot;Can´t convert NoneType to int&quot; issue on Thu, 04 Jan 2024 09:18:14 GMT]]></title><description><![CDATA[<p dir="auto">I found a workaround meanwhile with if-else.</p>
<p dir="auto">It is not nice, but it´s working:</p>
<ul>
<li>
<p dir="auto">I convert the DAC Value into a String.</p>
</li>
<li>
<p dir="auto">Then I check, if it is "None", if yes I send a 0 to the DAC.</p>
</li>
<li>
<p dir="auto">If DAC Value is not "None" I convert it back to integer and send it directly to the DAC.</p>
</li>
</ul>
<p dir="auto"><img src="/assets/uploads/files/1704359886045-92383df8-f87b-449d-977a-84a9a8fc9ffc-image-resized.png" alt="0_1704359879454_92383df8-f87b-449d-977a-84a9a8fc9ffc-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/post/23223</link><guid isPermaLink="true">https://community.m5stack.com/post/23223</guid><dc:creator><![CDATA[RoToR]]></dc:creator><pubDate>Thu, 04 Jan 2024 09:18:14 GMT</pubDate></item></channel></rss>