How can i use mqtt in lvgl

I’m using:

SquareLine Studio 1.0.4

##Esp32 DevKitV1

I’m having some difficulty
In my project, I would like to combine the use of the PubSubClient(mqtt) library and LVGL(SquareLine)
I would like to find out:

  1. how can I effectively and without bugs combine their work
  2. how can I change the state of the button, like a switch, that is, On Off, through mqtt
    3)how can i change Arc state via mqtt

Many thanks in advance


MQTT exists “next to” LVGL so they shouldn’t cause bugs in each other.

To react on an MQTT message in LVGL, just call lv_arc_set_value() or similar function when you get a message.

Note that LVGL is not thread safe so please read this section of LVGL’s docs:

Thanks for the answer. I would like to know how I can use mqtt in ui_events.c file. That is, I want to get: when the button is clicked, send the value to mqtt.

“my device is esp32, i program in arduino ide”

Could you already use MQTT without SquareLine or LVGL?

hi. I also want to use WiFi.h library in ui_envents but it gives me this error. please help me

i solved it by changing ui_events.c to ui_events.cpp. Thank for all