Error in comparison
-
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.
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.
I find no problems in the Python code. The two variables are numerical and the comparison should not generate an error.
What could be wrong?--Python code
from m5stack import *
from m5ui import *
from uiflow import *
import time
import unitsetScreenColor(0x111111)
gps_0 = unit.get(unit.GPS, unit.PORTA)Velocidad = None
label0 = M5TextBox(96, 23, "000", lcd.FONT_DejaVu72, 0xFFFFFF, rotate=90)
label1 = M5TextBox(125, 32, "Velocidad", lcd.FONT_Default, 0xFFFFFF, rotate=90)
label2 = M5TextBox(60, 169, "Km/h", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=90)gps_0.uart_port_id(1)
gps_0.set_time_zone((-3))
while True:
Velocidad = gps_0.speed_kph
label0.setText(str(Velocidad))
if Velocidad > 110:
label0.setColor(0xffffff)
else:
label0.setColor(0xff0000)
wait(2)
wait_ms(2)