E32R35T & E32N35T 3.5-inch ESP32-32E Demo Instructions
Provided by LCDwiki
1. Software and Hardware Platform Description
Module: 3.5-inch ESP32-32E display module with 320x480 resolution and ST7796 screen driver IC.
Module Master: ESP32-WROOM-32E module, featuring a maximum main frequency of 240MHz, supporting 2.4G WiFi and Bluetooth.
Arduino IDE Versions: 1.8.19 and 2.3.2.
ESP32 Arduino Core Library Software Versions: 2.0.17 and 3.0.3.
2. Pin Allocation Instructions
Figure 2.1: Rear view of the 3.5-inch ESP32-32E display module, showing various components and pin headers.
The main controller of the 3.5-inch ESP32 display module is the ESP32-32E. The GPIO allocation for its onboard peripherals is detailed in the table below:
On board device | On board device pins | ESP32-32E connection pin | Description |
---|---|---|---|
LCD | TFT_CS | IO15 | LCD screen chip selection control signal, low level effective. |
LCD | TFT_RS | IO2 | LCD screen command/data selection control signal. High level: data, low level: command. |
LCD | TFT_SCK | IO14 | SPI bus clock signal (shared by LCD screen and touch screen). |
LCD | TFT_MOSI | IO13 | SPI bus write data signal (shared by LCD screen and touch screen). |
LCD | TFT_MISO | IO12 | SPI bus read data signal (shared by LCD screen and touch screen). |
LCD | TFT_RST | EN | LCD screen reset control signal, low level reset (shared reset pin with ESP32-32E main control). |
LCD | TFT_BL | IO27 | LCD screen backlight control signal (high level lights up the backlight, low level turns off the backlight). |
RTP | TP_SCK | IO14 | SPI bus clock signal (shared by touch screen and LCD screen). |
RTP | TP_DIN | IO13 | SPI bus write data signal (shared by touch screen and LCD screen). |
RTP | TP_DOUT | IO12 | SPI bus read data signal (shared by touch screen and LCD screen). |
RTP | TP_CS | IO33 | Resistance touch screen chip selection control signal, low level effective. |
RTP | TP_IRQ | IO36 | Resistive touch screen touch interrupt signal; when a touch is generated, input a low level to the main control. |
LED | LED_RED | IO22 | Red LED light. |
LED | LED_GREEN | IO16 | Green LED light. |
LED | LED_BLUE | IO17 | Blue LED light. |
RGB tri-color LED light, with a common anode, lit at low level and turned off at high level. | |||
SDCARD | SD_CS | IO5 | SD card signal selection, low level effective. |
SDCARD | SD_MOSI | IO23 | SD card SPI bus write data signal. |
SDCARD | SD_SCK | IO18 | SD card SPI bus clock signal. |
SDCARD | SD_MISO | IO19 | SD card SPI bus read data signal. |
BATTERY | BAT_ADC | IO34 | Battery voltage ADC value acquisition signal (input). |
Audio | Audio_ENABLE | IO4 | Audio enable signal, low-level enable, high-level disable. |
Audio | Audio_DAC | IO26 | Audio signal DAC output signal. |
KEY | BOOT_KEY | IO0 | Download mode selection button (press and hold the button to power on, then release it to enter download mode). |
Serial Port | RESET_KEY | EN | ESP32-32E reset button, low level reset (shared with LCD screen reset). |
Serial Port | RX0 | RXD0 | ESP32-32E serial port receiving signal. |
Serial Port | TX0 | TXD0 | ESP32-32E serial port sends signal. |
POWER | TYPE-C_POWER | / | Type-C power interface, connected to 5V voltage. |
3. Instructions for Using the Example Program
3.1. Set up ESP32 Arduino Development Environment
For detailed instructions on setting up the ESP32 Arduino development environment, please refer to the documentation in the package titled "Arduino_IDE1_development_environment_construction_for_ESP32" and "Arduino_IDE2_development_environment_construction_for_ESP32".
3.2. Install Third-Party Software Libraries
After setting up the development environment, the first step is to install the third-party software libraries used by the sample program. The steps are as follows:
- Open the "1-示例程序_Demo \ Arduino \ Install libraries" directory in the package and find the third-party software library, as shown in the following figure.
Figure 3.1: Screenshot of a file explorer window displaying the 'Install libraries' folder, listing various third-party software libraries like ArduinoJson, TFT_eSPI, and Lvgl.
Library Descriptions:
- ArduinoJson: C++JSON software library for Arduino and the Internet of Things.
- ESP32-audioI2S: ESP32's audio decoding software library that uses ESP32's I2S bus to play audio files in formats such as mp3, m4a, and wav from SD cards through external audio devices.
- ESP32Time: Arduino software library for setting and retrieving internal RTC time on the ESP32 board.
- HttpClient: An HTTP client software library that interacts with Arduino's web server.
- Lvgl: A highly customizable, low resource consuming, aesthetically pleasing, and easy-to-use embedded system graphics software library.
- NTPClient: Connects to an NTP client software library to an NTP server.
- TFT_eSPI: The Arduino graphics library for TFT-LCD screens, supporting multiple platforms and LCD driver ICs.
- Time: A software library that provides timing functionality for Arduino.
- TJpg_Decoder: The Arduino platform JPG format image decoding library that can decode JPG files from SD cards or Flash and display them on the LCD.
- XT_DAC_Audio: The ESP32 XTronic DAC audio software library supports WAV format audio files.
Installation Steps:
- Copy these software libraries to the library directory of the project folder. The library directory of the project folder defaults to "C:\Users\Administrator\Documents\Arduino\libraries" (the red part represents the actual username of the computer). If the project folder path is modified, it needs to be copied to the modified project folder library directory.
- After the installation of the third-party software library is completed, you can open the sample program for use.
The Lvgl and TFT_eSPI software libraries require configuration before use. The software libraries provided in the package are already configured. If you prefer to use the latest versions, you can download them from GitHub and configure them manually. The download links are as follows:
- Lvgl: https://github.com/lvgl/lvgl/tree/release/v8.3 (Only V8.x versions are compatible; V9.x is not supported)
- TFT_eSPI: https://github.com/Bodmer/TFT_eSPI
Download links for other software packages that do not require configuration:
- ArduinoJson: https://github.com/bblanchon/ArduinoJson.git
- ESP32Time: https://github.com/fbiego/ESP32Time
- HttpClient: http://github.com/amcewen/HttpClient
- NTPClient: https://github.com/arduino-libraries/NTPClient.git
- Time: https://github.com/PaulStoffregen/Time
- TJpg_Decoder: https://github.com/Bodmer/TJpg_Decoder
After library download is complete, unzip the folder (renaming is optional for distinction) and copy it to the project folder's library directory (default path: "C:\Users\Administrator\Documents\Arduino\libraries"). Next, perform library configuration by opening the "1-示例程序_Demo \ Arduino \ Replaced files" directory in the package and finding the replacement files, as shown in the following figure.
Figure 3.2: Screenshot of a file explorer window showing the 'Replaced files' directory, containing configuration files such as lv_conf.h, ST7796_Init.h, and User_Setup.h.
C. Configure LVGL library:
Copy the lv_conf.h
file from the "Replaced files" directory to the top-level directory of the lvgl library within the project library directory, as shown in the following figure.
Figure 3.3: Screenshot of a file explorer window showing the directory structure of the LVGL library, highlighting the location for the lv_conf.h file.
Open the lv_conf_internal.h
file in the src
directory of the lvgl library under the engineering library directory, as shown in the following figure.
Figure 3.4: Screenshot of a file explorer window showing the 'src' directory within the LVGL library, displaying files like lv_conf_internal.h.
After opening the file, modify the contents of line 41 as shown below (change the value to "../lv_conf.h"), and save the modification.
Figure 3.5: Code snippet showing the modification required in the lv_conf_internal.h file to include lv_conf.h.
Copy examples and demos from lvgl in the project library to src
in lvgl, as shown below:
Figure 3.6: Screenshot of a file explorer window showing the LVGL library directory structure, including 'src', 'scripts', 'examples', 'env_support', 'docs', and 'demos' folders.
Copy directory status:
Figure 3.7: Screenshot of the 'src' directory within the LVGL library, showing subfolders like 'extra', 'examples', 'draw', 'demos', and 'core'.
D. Configure TFT_eSPI library:
Firstly, rename the User_Setup.h
file in the top-level directory of the TFT_eSPI library under the project folder library directory to User_Setup_bak.h
. Then, copy the User_Setup.h
file from the "Replaced files" directory to the top-level directory of the TFT_eSPI library under the project library directory, as shown in the following figure.
Figure 3.8: Screenshot of a file explorer window showing the TFT_eSPI library directory, highlighting files like TFT_config.h, TFT_eSPI.cpp, TFT_eSPI.h, User_Setup.h, and User_Setup_bak.h.
Next, rename ST7796_Init.h
in the TFT_eSPI library's TFT_Drivers directory under the project folder directory to ST7796_Init_bak.h
, and then copy ST7796_Init.h
from the "Replaced files" directory to the TFD_eSPI library's TFT_Drivers directory under the project folder library directory, as shown in the following figure.
Figure 3.9: Screenshot of the 'TFT_Drivers' directory within the TFT_eSPI library, showing files related to display initialization and rotation.
3.3. Example Program Usage Instructions
The example programs are located in the "1-示例程序_Demo \ Arduino \ demos" directory of the package, as shown in the following figure.
Figure 3.10: Screenshot of a file explorer window listing various example programs for the ESP32-32E module, categorized by function (e.g., Simple_test, display_graphics, WiFi_scan, BLE_server).
The introduction of each example program is as follows:
- 01_Simple_test: This is a basic example program that does not rely on any third-party libraries. It requires an LCD display screen and performs full screen color filling and random rectangle filling. This example can be used to check if the display screen is functioning properly.
- 02_colligate_test: This example relies on the TFT_eSPI software library and requires an LCD display screen. The displayed content includes drawing points, lines, various graphic displays, and running time statistics, making it a comprehensive display example.
- 03_display_graphics: This example relies on the TFT_eSPI software library and requires an LCD display screen. The display content includes various graphic drawings and fillings.
- 04_display_scroll: This example requires the TFT_eSPI software library and an LCD display screen. The display content includes Chinese characters and images, scrolling text display, reversed color display, and rotation display in four directions.
- 05_show_SD_jpg_picture: This example relies on TFT_eSPI and TJpg_Decoder software libraries, and requires an LCD display screen and a MicroSD card. Its function is to read JPG images from a MicroSD card, parse them, and then display the images on the LCD. The example usage steps are:
- Copy the JPG images from the "PIC_320x480" directory in the sample folder to the root directory of the MicroSD card.
- Insert the MicroSD card into the SD card slot of the display module.
- Power on the display module, compile and download the sample program, and you will see pictures displayed alternately on the LCD screen.
- 06_RGB_LED_V2.0: This example does not rely on any third-party software libraries and uses the Arduino-ESP32 core software library version 2.0 (e.g., version 2.0.17). It requires RGB tri-color lights and demonstrates RGB three-color light on/off control, flicker control, and PWM brightness control.
- 06_RGB_LED_V3.0: This example does not rely on any third-party software libraries and uses the Arduino-ESP32 3.0 core software library (e.g., 3.0.3). The required hardware and functions are the same as those in the 06_RGB_LED_V2.0 example.
- 07_Flash_DMA_jpg: This example relies on the TFT_eSPI and TJpg_Decoder software libraries and requires an LCD display. It shows reading JPG images from the ESP32 module's Flash, parsing the data, and displaying the picture on the LCD. Example usage steps:
- Use an online tool (e.g., http://tomeko.net/online_tools/file_to_hex.php?lang=en) to process the JPG image.
- After successful processing, copy the data to the "image.h" file in the sample folder (the array can be renamed, and the sample program should be modified synchronously).
- Power on the display module, compile and download the example program to see the picture displayed on the LCD screen.
- 08_key_test: This example does not rely on any third-party software libraries. It requires the BOOT button and RGB three-color lights. This example demonstrates key event detection in polling mode while using the key to control the RGB three-color light.
- 09_key_interrupt: This example does not rely on any third-party software libraries. It requires the BOOT button and RGB three-color lights. This example demonstrates key event detection in interrupt mode, while using the key to control the RGB three-color light on and off.
- 10_uart: This example relies on the TFT_eSPI software library and requires a serial port and an LCD display. It shows how the ESP32 interacts with a PC via a serial port, sending and receiving information, and displaying it on the LCD screen.
- 11_RTC_test: This example relies on the TFT_eSPI and ESP32Time software libraries and requires an LCD display. It demonstrates using the ESP32's RTC module to set the real-time time and date and display it on the LCD.
- 12_timer_test_V2.0: This example does not rely on any third-party software libraries and uses the Arduino-ESP32 core software library version 2.0 (e.g., version 2.0.17). It requires RGB tri-color lights and shows the use of the ESP32 timer to control the green LED light (e.g., turning it on and off every second).
- 12_timer_test_V3.0: This example does not rely on any third-party software libraries and uses the Arduino-ESP32 3.0 core software library (e.g., 3.0.3). It requires RGB tri-color lights and demonstrates the same functionality as the 12_timer_test_V2.0 example.
- 13_Get_Battery_Voltage: This example relies on the TFT_eSPI software library and requires an LCD display and a 3.7V lithium battery. It demonstrates using the ESP32's ADC function to obtain and display the external lithium battery voltage on the LCD.
- 14_Backlight_PWM_V2.0: This example relies on the TFT_eSPI software library and uses the Arduino-ESP32 core software library version 2.0 (e.g., version 2.0.17). It requires an LCD display and a resistive touch screen. This example shows how to adjust the display's backlight brightness via touch slide operation.
- 14_Backlight_PWM_V3.0: This example relies on the TFT_eSPI software library and uses the Arduino-ESP32 3.0 core software library (e.g., version 3.0.3). It requires an LCD display and a resistive touch screen. This example shows the same functionality as the 14_Backlight_PWM_V2.0 example.
- 15_Audio_play_V2.0: This example relies on the TFT_eSPI, TJpg_Decoder, and ESP32-audioI2S software libraries, and uses the Arduino-ESP32 core software library version 2.0 (e.g., version 2.0.17). It requires an LCD display, resistive touch screen, speaker, and MicroSD card. It demonstrates reading an mp3 audio file from an SD card, displaying the file name on the LCD, and playing it in a loop. Touch icons on the display control audio playback (pause/play, mute/play). Example steps:
- Copy all mp3 audio files from the "mp3" directory in the sample folder to the MicroSD card (note: the example program loops a maximum of 10 mp3 songs).
- Insert the MicroSD card into the SD card slot of the display module.
- Power on the display module, compile and download the example program. The song name will be displayed on the LCD screen, and the external speaker will play sound. Touch the button icon on the operating screen to control audio playback.
- 16_Audio_WAV_V2.0: This example relies on the XT_DAC_Audio software library and uses the Arduino-ESP32 core software library version 2.0 (e.g., version 2.0.17). It requires speakers and demonstrates playing an audio file in WAV format using the ESP32. Steps:
- Edit the audio file, copy the generated audio data to the "Audio_data.h" file in the sample folder (the array can be renamed, and the sample program should be synchronized). Note: The edited audio file should not be too large to avoid exceeding the ESP32 module's internal Flash capacity. Adjust audio file length, sampling rate, and number of channels accordingly. Audacity is recommended for audio editing.
- Power on the display module, compile and download the example program to hear the speaker playing audio.
- 17_Buzzer_PiratesOfTheCaribian: This example does not rely on any third-party software libraries and requires speakers. It demonstrates using different frequencies to simulate acoustic vibration, causing the buzzer to sound.
- 18_WiFi_scan: This example relies on the TFT_eSPI software library and requires an LCD display and the ESP32 WIFI module. It shows the ESP32 WIFI module scanning surrounding wireless network information in STA mode. The scanned information (SSID, RSSI, CHANNEL, ENC_TYPE) is displayed on the LCD. The system displays the number of scanned networks, up to the first 17.
- 19_WiFi_AP: This example relies on the TFT_eSPI software library and requires an LCD display and the ESP32 WIFI module. It demonstrates setting the ESP32 WIFI module to AP mode for WIFI terminal connection. The display shows the SSID, password, host IP address, and host MAC address. Upon successful terminal connection, the display shows the number of terminal connections. Users can set their own SSID and password in the sample program variables, as shown in the following code snippet.
- 20_WiFi_SmartConfig: This example relies on the TFT_eSPI software library, the LCD display, ESP32 WIFI module, and the BOOT button. It demonstrates the ESP32 WIFI module in STA mode using the EspTouch mobile app for intelligent network distribution. The operation flowchart is shown in Figure 3.12. Steps:
- Download the EspTouch application on a mobile phone, or copy the installation program "esptouch-v2.0.0.apk" from the "7-工具软件_Tool_software" folder in the data package (Android only; iOS can be installed from the device). The installer can also be downloaded from the official website: https://www.espressif.com.cn/en/support/download/apps.
- Power on the display module, compile and download the sample program. If the ESP32 has not saved any WIFI information, it enters intelligent distribution mode. Open the EspTouch application, enter the WIFI SSID and password, and broadcast the information via UDP. The ESP32 will connect to the network using this information. Upon successful connection, it displays SSID, password, IP address, and MAC address, and saves the WIFI information. Note that the success rate may vary, and retries might be necessary.
- If the ESP32 has saved WIFI information, it will automatically connect when powered on. If the connection fails, it enters intelligent distribution mode. After a successful network connection, holding down the BOOT button for more than 3 seconds clears the saved WIFI information, and the ESP32 resets to perform intelligent network distribution again.
- 21_WiFi_STA: This example relies on the TFT_eSPI software library, the LCD display, and the ESP32 WIFI module. It shows how the ESP32 connects to WIFI in STA mode using the provided SSID and password. Steps:
- Write the WIFI information to be connected in the "ssid" and "password" variables at the beginning of the sample program, as shown in the following code snippet.
- Power on the display module, compile and download the example program. The ESP32 will start connecting to WIFI. Upon successful connection, information such as success message, SSID, IP address, and MAC address will be displayed. If the connection lasts longer than 3 minutes, it fails, and a failure message is displayed.
- 22_WiFi_STA_TCP_Client: This example relies on the TFT_eSPI software library, the LCD display, and the ESP32 WIFI module. It demonstrates the ESP32 in STA mode, connecting to WIFI and acting as a TCP client to a TCP server. Steps:
- At the beginning of the example program, write the required WIFI information, TCP server IP address (computer IP address), and port number into the "ssid", "password", "serverIP", and "serverPort" variables, as shown in Figure 3.14.
- Open a "TCP&UDP test tool" or "Network debugging assistant" on the computer (installation package in the "7-工具软件_Tool_software" directory). Create a TCP server in the tool, ensuring the port number matches the example program settings.
- Power on the display module, compile and download the example program. The ESP32 will start connecting to WIFI. Upon successful connection, information such as the success message, SSID, IP address, MAC address, and TCP server port number will be displayed. After successful connection, a message is displayed, enabling communication with the server.
- 23_WiFi_STA_TCP_Server: This example relies on the TFT_eSPI software library, the LCD display, and the ESP32 WIFI module. It demonstrates the ESP32 in STA mode, connecting to WIFI and acting as a TCP server for TCP client connections. Steps:
- Write the required WIFI information and TCP server port number into the "ssid", "password", and "port" variables at the beginning of the example program, as shown in Figure 3.15.
- Power on the display module, compile and download the example program. The ESP32 will start connecting to WIFI. Upon successful connection, information such as the success message, SSID, IP address, MAC address, and TCP server port number will be displayed. The TCP server is then created, and the TCP client is connected.
- Open a "TCP&UDP test tool" or "Network debugging assistant" on the computer (installation package in the "7-工具软件_Tool_software" directory). Create a TCP client in the tool (ensure the IP address and port number match the displayed content). Then, start connecting to the server. If the connection is successful, a prompt will be displayed, allowing communication with the server.
- 24_WiFi_STA_UDP: This example relies on the TFT_eSPI software library, the LCD display, and the ESP32 WIFI module. It demonstrates the ESP32 in STA mode, connecting to WIFI and acting as a UDP server for UDP client connections. Steps:
- Write the required WIFI information and UDP server port number into the "ssid", "password", and "localUdpPort" variables at the beginning of the sample program, as shown in Figure 3.16.
- Power on the display module, compile and download the example program. The ESP32 will start connecting to WIFI. Upon successful connection, information such as the success message, SSID, IP address, MAC address, and local port number will be displayed. A UDP server is then created, waiting for the UDP client to connect.
- Open a "TCP&UDP test tool" or "Network debugging assistant" on the computer (installation package in the "7-工具软件_Tool_software" directory). Create a UDP client in the tool (ensure the IP address and port number match the displayed content). Then, start connecting to the server. If the connection is successful, a prompt will be displayed, allowing communication with the server.
- 25_BLE_scan_V2.0: This example relies on the TFT_eSPI software library and uses the Arduino-ESP32 core software library version 2.0 (e.g., version 2.0.17). It requires an LCD display and the ESP32 Bluetooth module. This example shows the ESP32 Bluetooth module scanning for nearby BLE Bluetooth devices and displaying the name and RSSI of the scanned BLE Bluetooth device on the LCD.
- 25_BLE_scan_V3.0: This example relies on the TFT_eSPI software library and uses the Arduino-ESP32 3.0 core software library (e.g., version 3.0.3). It requires an LCD display and the ESP32 Bluetooth module. The functionality is the same as the 25_BLE_scan_V2.0 sample program.
- 26_BLE_server_V2.0: This example relies on the TFT_eSPI software library and uses the Arduino-ESP32 core software library version 2.0 (e.g., version 2.0.17). It requires an LCD display and the ESP32 Bluetooth module. This example shows how the ESP32 Bluetooth module creates a Bluetooth BLE server, connects to a Bluetooth BLE client, and communicates. Steps:
- Install Bluetooth BLE debugging tools on your phone, such as "BLE debugging Assistant" or "LightBlue".
- Power on the display module, compile and download the example program. The Bluetooth BLE client running prompt will appear on the display. To change the Bluetooth BLE server device name, modify the "BLEDevice::init" function parameter in the example program, as shown in Figure 3.17.
- Open Bluetooth on your mobile phone and the Bluetooth BLE debugging tool. Search for the Bluetooth BLE server device name (default is "ESP32_BT_BLE"), then click the name to connect. Upon successful connection, the ESP32 display module will prompt, and Bluetooth communication can proceed.
- 26_BLE_server_V3.0: This example relies on the TFT_eSPI software library and uses the Arduino-ESP32 3.0 core software library (e.g., version 3.0.3). It requires an LCD display and the ESP32 Bluetooth module. This example is the same as the 26_BLE_server_V2.0 example.
- 27_Desktop_Display: This example program relies on ArduinoJson, Time, HttpClient, TFT_eSPI, TJpg_Decoder, and NTPClient software libraries. It requires an LCD display and the ESP32 WIFI module. This example shows a weather clock desktop that displays city weather conditions (temperature, humidity, weather icons, and scrolling weather information), the current time and date, and an astronaut animation. Weather information is obtained from the network, and time information is updated from the NTP server. Steps:
- After opening the example, set the tool -> Partition Scheme to "Huge APP (3MB No OTA /1MB SPIFFS)" option; otherwise, the compiler will report an insufficient memory error.
- Write the WIFI information to be connected in the "ssid" and "passwd" variables at the beginning of the sample program, as shown in Figure 3.17 (note: if not set, refer to the intelligent distribution example program for details on intelligent distribution network setup).
- Power on the display module, compile and download the example program. The weather clock desktop will be displayed on the screen.
- 28_display_phonecall: This example relies on the TFT_eSPI software library. It requires an LCD display and a resistive touch screen. This example shows a simple dialing interface for a mobile phone, with content entered via button touches.
- 29_touch_pen: This example relies on the TFT_eSPI software library. It requires an LCD display and a resistive touch screen. This example demonstrates checking touch screen functionality by drawing lines on the display.
- 30_RGB_LED_TOUCH_V2.0: This example relies on the TFT_eSPI software library and uses the Arduino-ESP32 core software library version 2.0 (e.g., version 2.0.17). It requires an LCD display, a resistive touch screen, and RGB tri-color lights. This example shows controlling the RGB light on/off, flicker, and brightness adjustment via touch.
- 30_RGB_LED_TOUCH_V3.0: This example relies on the TFT_eSPI software library and uses the Arduino-ESP32 3.0 core software library (e.g., version 3.0.3). It requires an LCD display, a resistive touch screen, and RGB tri-color lights. This example shows the same functionality as the 30_RGB_LED_TOUCH_V2.0 test example.
- 31_LVGL_Demos: This example relies on TFT_eSPI and the lvgl software library. It requires an LCD display and a resistance touch screen. This example showcases the five built-in demo features of the lvgl embedded UI system, allowing users to learn how to port lvgl to the ESP32 platform and configure underlying devices like the display and touch screen. In the sample program, only one demo can be compiled at a time. Remove comments from the desired demo and add comments to others, as shown in Figure 3.18.
LVGL Demo Descriptions:
- lv_demo_widgets: Tests various widgets.
- lv_demo_benchmark: Performance benchmark demo.
- lv_demo_keypad_encoder: Keyboard encoder test demo.
- lv_demo_music: Music player test demo.
- lv_demo_stress: Stress test demo.
Note: The first compilation of this example may take a significant amount of time, approximately 15 minutes.
32_WiFi_webserver: This example relies on the TFT_eSPI software library and requires an LCD display and RGB three-color lights. It demonstrates setting up a web server, accessing it from a computer, and manipulating an icon on the web interface to control the RGB three-color light. Steps:
- Write the WIFI information to be connected in the "ssid" and "password" variables at the beginning of the sample program, as shown in Figure 3.19.
- Power on the display module, compile and download the example program. The ESP32 will start connecting to WIFI. Upon successful connection, information such as the success message, SSID, IP address, and MAC address will be displayed.
- Enter the IP address shown in the previous steps into the browser's URL input field on the computer. This allows access to the web interface, where clicking the corresponding icon controls the RGB three-color light.
Touch_calibrate: This program relies on the TFT_eSPI software library and is specifically designed for the calibration of resistive touch screens. The calibration steps are as follows:
- Open the calibration program and set the display direction of the display screen, as shown in Figure 3.20. This setting must be consistent with the actual display direction for accurate calibration. The code snippet
tft.setRotation(1);
is provided. - Power on the display module, compile and download the example program. The calibration interface will appear on the display screen. Click the four corners according to the arrow prompts.
- After calibration is completed, the calibration result is output through the serial port, as shown in Figure 3.21. The calibration detection interface is then entered, and tested by drawing dots and lines.
- After the calibration result is accurate, copy the serial port calibration parameters to the example program used. The following code snippet shows an example:
uint16_t calData [5] = { 252, 3653, 243, 3485, 7}; tft.setTouch (calData);