Please help me upload a png image from the SD card on ESP32s3

Hello everyone,
I would like to import a png image from the sd card into the button “ui_ImgButton1” so that it changes the original image when the button is pressed.
This is my code:

void ui_Screen1_screen_init(void){
    ui_Screen1 = lv_obj_create(NULL);
    lv_obj_clear_flag(ui_Screen1, LV_OBJ_FLAG_SCROLLABLE);      
    ui_ImgButton1 = lv_imgbtn_create(ui_Screen1);
    lv_imgbtn_set_src(ui_ImgButton1, LV_IMGBTN_STATE_RELEASED, NULL, &ui_img_bt_red_png, NULL);
    
    lv_imgbtn_set_src(ui_ImgButton1, LV_IMGBTN_STATE_PRESSED, NULL, "S:/bt_yw.png", NULL);

    lv_obj_set_height(ui_ImgButton1, 50);
    lv_obj_set_width(ui_ImgButton1, LV_SIZE_CONTENT);  
    lv_obj_set_x(ui_ImgButton1, 4);
    lv_obj_set_y(ui_ImgButton1, -4);
    lv_obj_set_align(ui_ImgButton1, LV_ALIGN_CENTER);
}

Where am I wrong?
Can anyone advise me how to do it?
Thanks.

  • SquareLine Studio version: 1.2.1
  • **Operating system: win 10 - Arduino
  • **Target hardware: ESP32s3

Did you set up a the file system correctly? Please enable the logging of LVGL
to see what could be the problem.

The problem has been fixed, it’s due to my inexperience with Arduino programming.
Everything works fine, with sd very slow but with Ffat better.
So all ok, sorry for opening the topic.
Thanks!

1 Like

Hi Emanuele75,
I am having the same issue that you were facing, if possible, can you please share the code/lv_conf.h setting that worked for you.
Your help is highly appreciated.

The original poster didn’t share what the problem with his code was, what the symptom was. You didn’t share either what problem you face with. (Compilation or runtime problems? Arduino-IDE related?).
If you specify some circumstances you’ll have more chance to find a solution at the forum.