LVGL add Seriel to events

i wanna add seriel to event,i got this msg,"error: ‘Serial’ undeclared (first use in this function)
Serial.print(“TRIGGERED”);
^~~~~~
"

static void ui_event_Button3(lv_event_t * e)
{
lv_event_code_t event = lv_event_get_code(e);
lv_obj_t * ta = lv_event_get_target(e);
if(event == LV_EVENT_CLICKED) {
Serial.print(“TRIGGERED”);
}

You have to use logging function from LVGL. Look at docs.

LV_LOG_USER("Some text to log");

or you can print value of some varaible like this:

LV_LOG_USER("Value of variable is: %d\n", value);

I hope this helps.

You will also probably need to enable loging in lv_conf.h file.

Thank you for reply
sorry maybe i didn’t understand,i have tried to read the order but nothing popup in my serial monitor:
Note: i’m working on ESP32

#include <lvgl.h>

void setup() {

Serial.begin(115200);
}

void loop() {
// LV_LOG_USER(“Some text to log”);
LV_LOG_USER(“Value of variable is: %d\n”, value);
}

That is not enough :wink: . Start with Arduino example for LVGL and put what I did send earler to end of the setup() function.

Btw, if you want to post some code, pls use preformatted text :slight_smile: