Prova_basica_1:
Captura de pantalla 2025-04-30 a las 14.49.52.png
Prova_basica_2
Captura de pantalla 2025-04-30 a las 14.52.25.png
Hello there,
I've almost arrived at my goal!
I've almost arrived at my goal! But; I don't know how I should continue. I will send you two files. They're created with Uiflow 2.0. The first version, named Prova_basica_1 is absolutely functional, and the second one, named Prova_basica_2, is my nightmare!
The trouble finds in the conversion from ASCII code to character, I can't do it
Please, may you aid me?
Thank you, and excuse me for the inconveniences.
Best regards!
P.S. In this message I send you two images from UiFlow 2.0 program and I've just attached below the code from two programs
Code Prova_basica_1:
import os, sys, io
import M5
from M5 import *
from unit import CardKBUnit
from hardware import I2C
from hardware import Pin
label0 = None
i2c0 = None
cardkb_0 = None
text = None
def cardkb_0_pressed_event(kb):
global label0, i2c0, cardkb_0, text
text = cardkb_0.get_string()
M5.Lcd.printf(text)
def setup():
global label0, i2c0, cardkb_0, text
M5.begin()
Widgets.fillScreen(0x222222)
label0 = Widgets.Label("label0", 105, 143, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)
i2c0 = I2C(0, scl=Pin(33), sda=Pin(32), freq=100000)
cardkb_0 = CardKBUnit(i2c0)
cardkb_0.set_callback(cardkb_0_pressed_event)
Widgets.fillScreen(0xffffff)
M5.Lcd.startWrite()
M5.Lcd.setCursor(10, 40)
M5.Lcd.setTextSize(2)
M5.Lcd.print('>>', 0x000000)
def loop():
global label0, i2c0, cardkb_0, text
M5.update()
cardkb_0.tick()
if name == 'main':
try:
setup()
while True:
loop()
except (Exception, KeyboardInterrupt) as e:
try:
from utility import print_error_msg
print_error_msg(e)
except ImportError:
print("please update to latest firmware")
Code Prova_basica_2:
import os, sys, io
import M5
from M5 import *
from unit import CardKBUnit
from hardware import I2C
from hardware import Pin
label0 = None
i2c0 = None
cardkb_0 = None
text = None
text2 = None
def cardkb_0_pressed_event(kb):
global label0, i2c0, cardkb_0, text, text2
text = cardkb_0.get_string()
M5.Lcd.printf(text)
text2 = str((chr(text)))
label0.setText(str(text2))
def setup():
global label0, i2c0, cardkb_0, text, text2
M5.begin()
Widgets.fillScreen(0x222222)
label0 = Widgets.Label("label0", 105, 143, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)
i2c0 = I2C(0, scl=Pin(33), sda=Pin(32), freq=100000)
cardkb_0 = CardKBUnit(i2c0)
cardkb_0.set_callback(cardkb_0_pressed_event)
Widgets.fillScreen(0xffffff)
M5.Lcd.startWrite()
M5.Lcd.setCursor(10, 40)
M5.Lcd.setTextSize(2)
M5.Lcd.print('>>', 0x000000)
def loop():
global label0, i2c0, cardkb_0, text, text2
M5.update()
cardkb_0.tick()
if name == 'main':
try:
setup()
while True:
loop()
except (Exception, KeyboardInterrupt) as e:
try:
from utility import print_error_msg
print_error_msg(e)
except ImportError:
print("please update to latest firmware")