Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
---|
esp_lcd supports I2C interfaced OLED LCD, whose color depth is usually 1bpp.
This example shows how to make use of the SSD1306 panel driver from esp_lcd
component to facilitate the porting of LVGL library. In the end, example will display a scrolling text on the OLED screen.
This example is using the LVGL8 version. For use it with LVGL9 version, please remove this line from idf_component.yml file:
Plaintext
lvgl/lvgl: "^8"
The connection between ESP Board and the LCD is as follows:
Plaintext
ESP Board OLED LCD (I2C)
+------------------+ +-------------------+
| GND+--------------+GND |
| | | |
| 3V3+--------------+VCC |
| | | |
| SDA+--------------+SDA |
| | | |
| SCL+--------------+SCL |
+------------------+ +-------------------+
The GPIO number used by this example can be changed in lvgl_example_main.c. Please pay attention to the I2C hardware device address as well, you should refer to your module's spec and schematic to determine that address.
Run idf.py -p PORT build flash monitor
to build, flash and monitor the project. A scrolling text will show up on the LCD as expected.
The first time you run idf.py
for the example will cost extra time as the build system needs to address the component dependencies and downloads the missing components from registry into managed_components
folder.
(To exit the serial monitor, type Ctrl-]
.)
See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
Bash
...
I (0) cpu_start: Starting scheduler on APP CPU.
I (345) example: Initialize I2C bus
I (345) example: Install panel IO
I (345) example: Install SSD1306 panel driver
I (455) example: Initialize LVGL library
I (455) example: Register display driver to LVGL
I (455) example: Install LVGL tick timer
I (455) example: Display LVGL Scroll Text
...
To create a project from this example, run:
idf.py create-project-from-example "espressif/esp_lvgl_port=2.3.2:i2c_oled"