How do you send ESP32/Arduino variable to Squareline's GUI?

Im trying to get the ESP32 to send stuff like automatically update text label for Temperature sensor data and various other inputs.

I already managed to get the other way around working, clicking a button on my touchscreen prints in the output. But i’m not sure how to do it backwards and send data to the GUI.

Squareline 1.3.4
Windows 10
Sunton ESP32 480x272

Additionally, since editing text value might be rather simple, what would be the most convenient way of creating an event. like say, open a new page that displays an alarm animation. Are there some kind of invisible variables within squareline studio that i can use to create events, then trigger them remotely from the ESP32 code?
(Programmed from Arduino IDE 2.2.1)

1 Like

If you need to pass numbers to a label:
lv_label_set_text_fmt(ui_Label1, “%d”, data);
ui_Label1 - label name
data - the name of your variable
Only integers can be passed

What do you mean integer only,is there is no way to send string values? How would you, say, create a wifi scanning page and receive the string value for the name?

Also, where do i put this code? Its not working

Exist many variants, but most simple and classic is place this code into loop code as event triggered by previously showed data require change (for example temperature) And ofcourse no only integer , show is based on func used …

can you show me how to,do i need to modify event or other?
v_label_set_text_fmt(ui_Label1, “%d”, data)
this made an error like d is not defined

(replaced label name variable data by my own value)

Thanks in advance

   This code should work if you declare as 'int' and init the 'data' variable well (and add an 'l' at the beginning of function name). No explicit events are needed to update a label widget's text, you just need to use the lv_label_set_text function. If you want to watch the change of a string or variable and set this automatically you need to do it periodically ('observe' in main loop) as Marian_M suggets.
1 Like

Thanks to all for help!

if i put this lv_label_set_text(ui_Pressure,“test 123”);
no problem,it work.
if i put this lv_label_set_text_fmt(ui_Pressure, “%d”, MyVAR);
Doesn`t work,gave me d not declared and something about chars convertion permissive.

what is fmt and %d ?

this doesn`t work too lv_label_set_text(ui_Pressure,MYVAR);

i`m only stuck with this,as a newbies i am.

i don`t see anything about ‘l’ at the beginning.

thanks in advance!!!
(i will surely buy a plan,like a small business)

What is fmt and % learn in standart C printf

Thanks for the help. I got some progress.

Is there any Wiki with more information? I couldnt find this on


i think is Compiler that doesn`t take this “old” command,i will check that

Finally Found the Error…
lv_label_set_text_fmt(ui_Label1, “%d”, data); this doesn’t work lol!
lv_label_set_text_fmt(ui_Label1, “%d”, data); this work

i took many hour to find the problem,… that was only " "

thanks to all helper’s!!!

If you want to send a floating point value formatted to, say, 2 decimal places, you can use:

lv_label_set_text_fmt(ui_Label1, “%.2f”, data)


Thanks for the tips,

tried,i have only f printed on screen.

thanks again

You probably need to turn on the floating point support in lv_conf.h if it’s not set already. So search for LV_SPRINTF_USE_FLOAT definition in lv_conf.h and set it to 1 if it’s 0… This is needed to enable printing floating numbers by sprintf which is used by lv_label_set_text_fmt.