<?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[Error in comparison]]></title><description><![CDATA[<p dir="auto">I'm trying to make a program to read the speed data from the Mini GPS/BDS module in UIFlow1 but I'm getting a confusing error.<br />
The code can be seen attached. The error occurs when I add the IF block and the comparison is something other than EQUAL. If the question is whether the first variable is greater than the second, on the M5Stick you briefly see the label with the speed value (0) but then a red circle with a cross inside appears, which I assume is an error signal.<br />
I find no problems in the Python code. The two variables are numerical and the comparison should not generate an error.<br />
What could be wrong?</p>
<p dir="auto">--Python code<br />
from m5stack import *<br />
from m5ui import *<br />
from uiflow import *<br />
import time<br />
import unit</p>
<p dir="auto">setScreenColor(0x111111)<br />
gps_0 = unit.get(unit.GPS, unit.PORTA)</p>
<p dir="auto">Velocidad = None</p>
<p dir="auto">label0 = M5TextBox(96, 23, "000", lcd.FONT_DejaVu72, 0xFFFFFF, rotate=90)<br />
label1 = M5TextBox(125, 32, "Velocidad", lcd.FONT_Default, 0xFFFFFF, rotate=90)<br />
label2 = M5TextBox(60, 169, "Km/h", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=90)</p>
<p dir="auto">gps_0.uart_port_id(1)<br />
gps_0.set_time_zone((-3))<br />
while True:<br />
Velocidad = gps_0.speed_kph<br />
label0.setText(str(Velocidad))<br />
if Velocidad &gt; 110:<br />
label0.setColor(0xffffff)<br />
else:<br />
label0.setColor(0xff0000)<br />
wait(2)<br />
wait_ms(2)<br />
<img src="/assets/uploads/files/1714939873382-uiflow_block_1714939860442.png" alt="0_1714939873125_uiflow_block_1714939860442.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/topic/6420/error-in-comparison</link><generator>RSS for Node</generator><lastBuildDate>Thu, 07 May 2026 15:05:23 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/6420.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 05 May 2024 20:11:24 GMT</pubDate><ttl>60</ttl></channel></rss>