<?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[Convert to Integer and test of integer give an Error (solved)]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I am trying to convert a floating point number into an integer or to test if the number is a floating point number. Both attempts end in an error message as soon as a floating point number is really present.</p>
<p dir="auto">Here you should see pictures of Blocky, but doesn't work.<br />
<img alt="alt text" class=" img-fluid img-markdown" /><br />
<img alt="alt text" class=" img-fluid img-markdown" /><br />
<img alt="alt text" class=" img-fluid img-markdown" /></p>
<p dir="auto">Does anyone have a solution or what am I doing wrong?</p>
<p dir="auto">Thanks a lot<br />
Peter</p>
<p dir="auto">I have found my mistake. A string was passed to the function and not a float.</p>
<p dir="auto">Now it plays as it should.</p>
]]></description><link>https://community.m5stack.com/topic/1791/convert-to-integer-and-test-of-integer-give-an-error-solved</link><generator>RSS for Node</generator><lastBuildDate>Mon, 16 Mar 2026 02:31:44 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/1791.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 24 Mar 2020 15:58:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Convert to Integer and test of integer give an Error (solved) on Wed, 25 Mar 2020 07:25:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/700">@lukasmaximus</a></p>
<p dir="auto">Thanks for the tip. I hadn't thought of that. I thought I would have to construct my own block.</p>
<p dir="auto">Peter</p>
]]></description><link>https://community.m5stack.com/post/7898</link><guid isPermaLink="true">https://community.m5stack.com/post/7898</guid><dc:creator><![CDATA[Peter]]></dc:creator><pubDate>Wed, 25 Mar 2020 07:25:24 GMT</pubDate></item><item><title><![CDATA[Reply to Convert to Integer and test of integer give an Error (solved) on Wed, 25 Mar 2020 07:23:59 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><br />
I would like to try out the possibilities and limits of Blockly.</p>
]]></description><link>https://community.m5stack.com/post/7897</link><guid isPermaLink="true">https://community.m5stack.com/post/7897</guid><dc:creator><![CDATA[Peter]]></dc:creator><pubDate>Wed, 25 Mar 2020 07:23:59 GMT</pubDate></item><item><title><![CDATA[Reply to Convert to Integer and test of integer give an Error (solved) on Tue, 24 Mar 2020 22:52:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/1908">@Peter</a> if you want to add a regular python function that is supported by micropython but not included in blocks you can use the execute block found in the advanced section</p>
]]></description><link>https://community.m5stack.com/post/7894</link><guid isPermaLink="true">https://community.m5stack.com/post/7894</guid><dc:creator><![CDATA[lukasmaximus]]></dc:creator><pubDate>Tue, 24 Mar 2020 22:52:20 GMT</pubDate></item><item><title><![CDATA[Reply to Convert to Integer and test of integer give an Error (solved) on Tue, 24 Mar 2020 19:48:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/1908">@Peter</a><br />
I'm sorry, my knowledge is limited with arduino/C, Im at the very beginning with learning python as I literally very short with time.<br />
However, I don't suggest you to keep trying with blockly as block-building style coding is very limited.<br />
Better give raw python/c++ a try, as far as I know python will manipulate with your value like its an object unless you force it to use specific data type</p>
]]></description><link>https://community.m5stack.com/post/7892</link><guid isPermaLink="true">https://community.m5stack.com/post/7892</guid><dc:creator><![CDATA[Thrasher]]></dc:creator><pubDate>Tue, 24 Mar 2020 19:48:39 GMT</pubDate></item><item><title><![CDATA[Reply to Convert to Integer and test of integer give an Error (solved) on Tue, 24 Mar 2020 16:50:07 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></p>
<p dir="auto">i have tried further and found that the value is not given as text after all. But if I convert it to text and then count the number of "." I get the desired result. In Python there is isinstance() for type determination. But I did not find this in Blockly.</p>
<p dir="auto">Peter</p>
]]></description><link>https://community.m5stack.com/post/7891</link><guid isPermaLink="true">https://community.m5stack.com/post/7891</guid><dc:creator><![CDATA[Peter]]></dc:creator><pubDate>Tue, 24 Mar 2020 16:50:07 GMT</pubDate></item><item><title><![CDATA[Reply to Convert to Integer and test of integer give an Error (solved) on Tue, 24 Mar 2020 16:39:16 GMT]]></title><description><![CDATA[<p dir="auto">I never tried myself, but theoretically you can convert float to char string, than split it using C string instructions and than put desired part into integer. Im not sure blockly allows to do such tricks</p>
]]></description><link>https://community.m5stack.com/post/7890</link><guid isPermaLink="true">https://community.m5stack.com/post/7890</guid><dc:creator><![CDATA[Thrasher]]></dc:creator><pubDate>Tue, 24 Mar 2020 16:39:16 GMT</pubDate></item><item><title><![CDATA[Reply to Convert to Integer and test of integer give an Error (solved) on Tue, 24 Mar 2020 16:33:05 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></p>
<p dir="auto">Thank you Thrasher,<br />
I know how to round up. I am interested in testing whether a variable contains an integer or a floating point number. I wanted to cut off the fractional part by converting it to integer, subtract the integer from the number of unknown type and if the result is 0 then it is an integer.</p>
<p dir="auto">But since the value is probably passed as a string I have to find another way.</p>
<p dir="auto">Peter</p>
]]></description><link>https://community.m5stack.com/post/7889</link><guid isPermaLink="true">https://community.m5stack.com/post/7889</guid><dc:creator><![CDATA[Peter]]></dc:creator><pubDate>Tue, 24 Mar 2020 16:33:05 GMT</pubDate></item><item><title><![CDATA[Reply to Convert to Integer and test of integer give an Error (solved) on Tue, 24 Mar 2020 16:07:24 GMT]]></title><description><![CDATA[<p dir="auto">You can't, integer supports only complete values without " . "<br />
Probably adding something like 0.5 to float first and than trying to make it integer will help</p>
]]></description><link>https://community.m5stack.com/post/7888</link><guid isPermaLink="true">https://community.m5stack.com/post/7888</guid><dc:creator><![CDATA[Thrasher]]></dc:creator><pubDate>Tue, 24 Mar 2020 16:07:24 GMT</pubDate></item></channel></rss>