Help with ESP32 Display

Hi, I am a beginner with arduino and with programming boards, I have bought an esp32 and have been following a tutorial linked to the board on the waveshare page ( both linked at the bottom ). In this tutorial, there is a 8 demos, all of the demos work on my esp32 other than the LVGL ones, they get an error as they are looking for a file within the wrong directory. No matter what i try, i cannot get anything to display on my esp32 screen, nor can I flash it. If anyone would help me display something on my screen that would be greatly appreciated.

Hi @tkm4x.

Please provide the full text of the error.

I'll provide instructions you can follow to do that:


:red_exclamation_mark: This procedure is not intended to solve the problem. The purpose is to gather more information.


  1. Open the problematic demo in Arduino IDE.
  2. Select Sketch > Verify/Compile from the Arduino IDE menus.
  3. Wait for the compilation to fail.
  4. You will see a "Compilation error: ..." notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button on that notification.
  5. Open a reply here on this forum topic by clicking the "Reply" button.
  6. Click the <CODE/> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
  7. Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
    This will paste the compilation output into the code block.
  8. Move the cursor outside of the code block markup before you add any additional text to your reply.
  9. Click the "Reply" button to publish the post.

In case the output is longer than the forum software will allow to be added to a post, you can instead save it to a .txt file and then attach that file to a reply here.

Click here for attachment instructions

  1. Open any text editor program.
  2. Paste the copied output into the text editor.
  3. Save the file in .txt format.
  4. Open a reply here on this forum topic by clicking the "Reply" button.
  5. Click the "Upload" icon (Upload icon) on the post composer toolbar:

    The "Open" dialog will open.
  6. Select the .txt file you saved from the "Open" dialog.
  7. Click the "Open" button.
    The dialog will close.
  8. Click the "Reply" button to publish the post.

Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the .txt file onto the post composer field to attach it.

Thanks for the reply, here is the code:

type or paste codeIn file included from c:/Users/User/Documents/Arduino/libraries/lvgl/src/lv_init.h:16,
                 from c:/Users/User/Documents/Arduino/libraries/lvgl/lvgl.h:21,
                 from c:\Users\User\Documents\Arduino\libraries\lvgl\src/lvgl.h:16,
                 from C:\Users\User\Documents\Arduino\examples\08_LVGL_V9_Test\lvgl_port.c:4:
c:/Users/User/Documents/Arduino/libraries/lvgl/src/lv_conf_internal.h:60:18: fatal error: ../../lv_conf.h: No such file or directory
   60 |         #include "../../lv_conf.h"                /* Else assume lv_conf.h is next to the lvgl folder. */
      |                  ^~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1 here

Please check that lv_conf.h is correctly placed.

If you download demo from the link you posted and unzip it, you will find lvgl9/lv_conf.h.

ESP32-S3-LCD-3.16-Demo
ā”œā”€ā”€ Arduino
│   ā”œā”€ā”€ examples
│   └── libraries
│       ā”œā”€ā”€ ReadMe.txt
│       ā”œā”€ā”€ SensorLib
│       ā”œā”€ā”€ lvgl8
│       └── lvgl9
│           ā”œā”€ā”€ lv_conf.h <== this one
│           └── lvgl
ā”œā”€ā”€ ESP-IDF
└── Firmware

Then copy that lv_conf.h directly into the Arduino library folder.

c:/Users/<User>/Documents/Arduino/libraries/
ā”œā”€ā”€ lv_conf.h <== here
ā”œā”€ā”€ lvgl
ā”œā”€ā”€ ...
└── ...

Reference: Arduino - LVGL 9.3 documentation

Thanks again for the reply, I have reinstalled Arduino IDE so I can follow your instructions better, I have installed: ESP32 3.2.1 by espressif systems, in boards manager, then lvgl 9.3.0 in library manager. Then under Tools, I have selected the correct COM slot, and ESP32S3 Dev Module under board, then enabled USB CDC on boot. Then I downloaded, extracted, and moved everything under 'Arduino' ( from the demo ) into my existing 'Arduino' folder, this includes libraries, examples, and therefore the lv_conf.h file under lvgl9. Next I moved the file: 'lvgl9/lv_conf.h' into the directory you suggested. Then I ran the example under Arduino/08_LVGL_V9_Test/08_LVGL_V9_Test.ino ( which was imported from the provided demo folder which I linked in the original post.) which has solved the original error, but in turn provided a new error: `C:\Users\bubbl\Documents\Arduino\examples\08_LVGL_V9_Test\lvgl_port.c:13:10: fatal error: demos/lv_demos.h: No such file or directory
13 | #include "demos/lv_demos.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: demos/lv_demos.h: No such file or directory`

EDIT: Im not sure why the original error message didn't send in a code block, here it is again, also, I believe the file it is reffering to is located in:
C:\Users\User\Downloads\ESP32-S3-LCD-3.16-Demo\ESP32-S3-LCD-3.16-Demo\Arduino\libraries\lvgl9\lvgl\demos.

:\Users\User\Documents\Arduino\examples\08_LVGL_V9_Test\lvgl_port.c:13:10: fatal error: demos/lv_demos.h: No such file or directory
   13 | #include "demos/lv_demos.h"
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: demos/lv_demos.h: No such file or directory

If you installed it from library manager instead of using the downloaded lvgl9/lvgl, you need to set up the demos folder.

Follow the instructions at "Use the examples and demos" section in the reference page posted in post #4.

important:
Due to some the limitations of Arduino's build system you need to copy lvgl/examples to lvgl/src/examples. Similarly for the demos lvgl/demos to lvgl/src/demos.

lvgl
ā”œā”€ā”€ ...
ā”œā”€ā”€ demos <== Copy this folder into `src`
ā”œā”€ā”€ ...
ā”œā”€ā”€ src
│   ā”œā”€ā”€ core
│   ā”œā”€ā”€ demos <== Here copied
│   ā”œā”€ā”€ display
│   ā”œā”€ā”€ ...
│   └── widgets
ā”œā”€ā”€ ...
└── zephyr

Sorry, i don't fully understand what you're saying, I have read the referenced instructions, I am using a demo which has a .ino file so I don't think I should need to load using the 'lv_example' function? Anyway, I have copied the demos and example folder into the directory you suggested, I wasn't sure if this was in the Arduino/Libraries or Arduino/Examples directory, so I did both. However I am still getting the same error, in the directory: C:\Users\User\Documents\Arduino\libraries\lvgl9\lvgl\src, my folder now looks like this:


EDIT: I forgot to mention I am still getting the same error as in post 6.

I'm afraid that the following explanation confuses you.

Forget about lvgl9/lvgl for now. In other words, the following directory hierarchy is incorrect.

You said you installed LVGL 9.3.0 from the library manager, so your library folder should look like this:

c:/Users/<User>/Documents/Arduino/libraries/
ā”œā”€ā”€ ...
ā”œā”€ā”€ lv_conf.h
└── lvgl
    ā”œā”€ā”€ ...
    ā”œā”€ā”€ demos
    ā”œā”€ā”€ docs
    ā”œā”€ā”€ ...
    ā”œā”€ā”€ src
    │   ā”œā”€ā”€ core
    │   ā”œā”€ā”€ demos <== Copied from the folder above
    │   ā”œā”€ā”€ display
    │   ā”œā”€ā”€ ...
    │   └── widgets
    ā”œā”€ā”€ tests
    └── zephyr

The LVGL documentation is for everyone. In your case, you don't need to copy examples folder into src.

I see now, i have copied 'demos' into the correct directory now, this has solved the error, now I am presented with a new error:

In file included from c:\Users\bubbl\Documents\Arduino\libraries\lvgl\src/demos/lv_demos.h:35,
                 from C:\Users\bubbl\Documents\Arduino\examples\08_LVGL_V9_Test\lvgl_port.c:13:
c:\Users\bubbl\Documents\Arduino\libraries\lvgl\src/demos/widgets/lv_demo_widgets.h:17:10: fatal error: ../../src/draw/lv_draw.h: No such file or directory
   17 | #include "../../src/draw/lv_draw.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

the file 'lv_draw.h' is located in: C:\Users\User\Documents\Arduino\libraries\lvgl\src\draw

This error, like this issue, is a common error with the Arduino version of LVGL. I often encounter this type of error :wink:

Open lv_demo_widgets.h with some editor (it's easy to drag & drop to Arduino IDE) and replace the code:

as follows:

/*********************
 *      INCLUDES
 *********************/
#include "../lv_demos.h"
#include "../../../src/draw/lv_draw.h"
#include "../../../src/draw/lv_draw_triangle.h"

By the way, lvgl9/lvgl/src/demos/widgets/lv_demo_widgets.h has been fixed this issue :tongue:

Thank you again, this has solved that error, however once again a new error has occured:

C:\Users\User\Documents\Arduino\examples\08_LVGL_V9_Test\src\demos\benchmark\assets\img_benchmark_cogwheel_alpha16.c:1:10: fatal error: ../../../lvgl.h: No such file or directory
    1 | #include "../../../lvgl.h"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: ../../../lvgl.h: No such file or directory```

Unfortunately, I can't find img_benchmark_cogwheel_alpha16.c under the Arduino\examples\08_LVGL_V9_Test\src\demos\benchmark\assets\ which downloaded from Waveshare.

Anyway, #include "../../../lvgl.h" should be #include "lvgl.h" if img_benchmark_cogwheel_alpha16.c is not located in the lvgl library folder.

That's strange, I cannot find a file named 'img_benchmark_cogwheel_alpha16.c'in that directory either, this may be a silly question, but where should i change '#include "../../../lvgl.h' to '#include "lvgl.h"'?

EDIT: I searched for the file, and it is found in 3 instances, all of them under lvgl8, the demo I am running is using lvgl9, so I'm not sure why i'm getting this error?

May be at line 1 in img_benchmark_cogwheel_alpha16.c.

I thought that, however there isn't a file with that name in that directory?, however there is files with the same name under lvgl8 in multiple locations, which of them should I edit?
They are found in these directories:
C:\Users\User\Documents\Arduino\libraries\lvgl8\lvgl\src\demos\benchmark\assets
C:\Users\User\Documents\Arduino\libraries\lvgl8\lvgl\demos\benchmark\assets
C:\Users\User\Documents\Arduino\examples\08_LVGL_V9_Test\src\demos\benchmark\assets

I have changed the file in all of those locations, however I am still getting the error, it looks like the file is made when the program runs? I am going to look at the directory in file explorer and verify the program to see what happens.

EDIT: The file name nkeeps changing, but with the same error, I am going to keep replacing the directory it is looking at with the one you said, I will reply when I get stuck on an error.

1 Like

Unfortunately, it's midnight, so I'll be back tomorrow.
Good luck!

Okay, thanks for your help, It seeems that every .c file within that directory has a wrong first line.

Just one before I go to bed.

You should remove lvgl8 in C:\Users\<User>\Documents\Arduino\libraries\.

Due to how Arduino compiles, the IDE may get confused.

Okay, thanks for this, it appears there is many more files with the wrong referenced directory inside, I am changing them all over to #include "lvgl.h" rather than #include "../../../lvgl.h"