Working with Arduino
This chapter contains the following sections. Please read as needed:
Arduino Getting Started
New to Arduino ESP32 development and looking for a quick start? We have prepared a comprehensive Getting Started Tutorial for you.
- Section 0: Getting to Know ESP32
- Section 1: Installing and Configuring Arduino IDE
- Section 2: Arduino Basics
- Section 3: Digital Output/Input
- Section 4: Analog Input
- Section 5: Pulse Width Modulation (PWM)
- Section 6: Serial Communication (UART)
- Section 7: I2C Communication
- Section 8: SPI Communication
- Section 9: Wi-Fi Basics
- Section 10: Web Server
- Section 11: Bluetooth
- Section 12: LVGL GUI Development
- Section 13: Comprehensive Project
Note: This tutorial uses the ESP32-S3-Zero as a reference example, and all hardware code is based on its pinout. Before you start, we recommend checking the pinout of your development board to ensure the pin configuration is correct.
Setting Up the Development Environment
1. Installing and Configuring the Arduino IDE
Please refer to the tutorial Installing and Configuring Arduino IDE to download and install the Arduino IDE and add ESP32 support.
2. Installing Libraries
To run the example, you need to install the corresponding library.
The example program package for the ESP32-C6-LCD-1.69 development board can be downloaded from here. The arduino\libraries directory within the package already includes all the library files required for this tutorial.
| Library/File Name | Description | Version | Installation Method |
|---|---|---|---|
| lvgl | LVGL graphics library | v8.4.0 | Online or manual installation |
| GFX_Library_for_Arduino | GFX graphics library | v1.6.0 | Online or manual installation |
| U8g2 | Graphics display library | v2.35.30 | Online or manual installation |
| SensorLib | Sensor library | v0.3.1 | Online or manual installation |
| OneButton | Button library | v2.6.1 | Online or manual installation |
There are strong dependencies between versions of LVGL and its driver libraries. For example, a driver written for LVGL v8 may not be compatible with LVGL v9. To ensure that the examples can be reproduced reliably, it is recommended to use the specific versions listed in the table above. Mixing different versions of libraries may lead to compilation failures or runtime errors.
Installation Steps:
-
Navigate to the downloaded example package.
-
Copy all folders (such as lvgl and lv_conf.h) from the
arduino\librariesdirectory to the Arduino libraries folder.infoThe path to the Arduino libraries folder is typically:
c:\Users\<username>\Documents\Arduino\libraries.You can also locate it in the Arduino IDE by going to File > Preferences and checking the "Sketchbook location". The libraries folder is the
librariessubfolder within this path. -
For other installation methods, please refer to: Arduino Library Management Tutorial.
3. Arduino Project Parameter Settings
[
]
Example
| Example | Basic Description | Dependency Library |
|---|---|---|
| 01_audio_out | Play PCM audio data via I2S interface | - |
| 02_button_example | Display battery voltage on the screen | OneButton |
| 03_battery_example | BOOT button single click, double click, long press, etc. | OneButton |
| 04_es8311_example | Real‑time playback of microphone audio through speaker | - |
| 05_gfx_helloworld | Display HelloWorld on the screen | GFX_Library_for_Arduino |
| 06_gfx_pdq_graphicstest | Graphics performance test and score display | GFX_Library_for_Arduino |
| 07_gfx_clock | Display an analog clock face on the screen | GFX_Library_for_Arduino |
| 08_gfx_u8g2_font | Load font libraries to display multilingual text | GFX_Library_for_Arduino, U8g2 |
| 09_gfx_image | Display an image on the screen | GFX_Library_for_Arduino |
| 10_esp_wifi_analyzer | Display Wi‑Fi band signal strength on the screen | GFX_Library_for_Arduino |
| 11_pcf85063_example | Display RTC time on the screen | GFX_Library_for_Arduino, SensorLib |
| 12_qmi8658_example | Display IMU data on the screen | GFX_Library_for_Arduino, SensorLib |
| 13_lvgl_arduino_v8 | LVGL v8 example program | lvgl (v8.4.0), GFX_Library_for_Arduino, SensorLib |
| 14_lvgl_arduino_v9 | LVGL v9 example program | lvgl (v9.3.0), GFX_Library_for_Arduino, SensorLib |
01_audio_out
Example Description
- This example demonstrates the ESP32-C6-LCD-1.69 playing PCM audio data.
Hardware Connection
- Connect the board to the computer using a USB cable.
Operation Result
- The device will play auido directly without showing content on the screen
02_button_example
Example Description
- This example demonstrates how to use the OneButton library to read single‑click, double‑click, and long‑press states of the BOOT and PWM buttons, and prints them to the serial port.
Hardware Connection
- Connect the board to the computer using a USB cable.
Code Analysis
-
Bind callback functions
button1.attachClick(click1);button1.attachDoubleClick(doubleclick1);button1.attachLongPressStart(longPressStart1);button1.attachLongPressStop(longPressStop1);button1.attachDuringLongPress(longPress1);
Operation Result
-
Open the serial monitor
03_battery_example
Example Description
This example demonstrates that ESP32-C6-LCD-1.69 displays the battery voltage in real time on the screen.
Hardware Connection
- Connect the board to the computer using a USB cable.
Operation Result
-
Open the serial monitor
04_es8311_example
Example Description
- This example demonstrates using the ESP32-C6-LCD-1.69 to drive the ES8311 audio codec, enabling real‑time playback of microphone audio through the speaker.
Hardware Connection
- Connect the board to the computer using a USB cable.
Code Analysis
-
After receiving a start signal, continuously read audio data and play it; upon receiving a stop signal, stop playback and wait for the next start.
void es8311_test_task(void *arg){const int limit_size_max = 1600;uint8_t data[limit_size_max];while (1){if (xSemaphoreTake(es8311_recording_BinarySemaphore, portMAX_DELAY) == pdTRUE){while (1){i2s.readBytes((char *)data, limit_size_max);i2s.write(data, limit_size_max);if (xSemaphoreTake(es8311_stop_BinarySemaphore, 0) == pdTRUE)break;}}}}
Operation Result
- The screen shows no output
- Press and hold the BOOT button; the speaker plays the microphone audio in real time.
05_gfx_helloworld
Example Description
- This example demonstrates the ESP32-C6-LCD-1.69 using the GFX_Library_for_Arduino library to drive the screen and display "HelloWorld".
Hardware Connection
- Connect the board to the computer using a USB cable.
Code Analysis
-
Configure the screen interface and resolution, etc.
Arduino_DataBus *bus = new Arduino_HWSPI(LCD_DC, LCD_CS, LCD_SCK, LCD_DIN);Arduino_GFX *gfx = new Arduino_ST7789(bus, LCD_RST, 0 /* rotation */, true /* IPS */,240 /* width */, 280 /* height */,0 /* col offset 1 */, 20 /* row offset 1 */,0 /* col offset 2 */, 20 /* row offset 2 */);
Operation Result
06_gfx_pdq_graphicstest
Example Description
- This example demonstrates the ESP32-C6-LCD-1.69 using the GFX_Library_for_Arduino library to run a graphics test and display a score.
Hardware Connection
- Connect the board to the computer using a USB cable.
Operation Result

07_gfx_clock
This example demonstrates that the ESP32-C6-LCD-1.69 uses the GFX_Library_for_Arduino library to display an analog clock dial
Hardware Connection
- Connect the board to the computer using a USB cable.
Operation Result
08_gfx_u8g2_font
Example Description
- This example demonstrates the ESP32-C6-LCD-1.69 using the GFX_Library_for_Arduino library to load font libraries and display multilingual text.
Hardware Connection
- Connect the board to the computer using a USB cable.
Operation Result
09_gfx_image
Example Description
- This example demonstrates the ESP32-C6-LCD-1.69 using the GFX_Library_for_Arduino library to display an image on the screen.
Hardware Connection
- Connect the board to the computer using a USB cable.
Preparation
- Open the Chinese Character Conversion Software.
- Import the image
images/image_1.jpgand convert it; this will generate theimage_1.hfile.

- Copy
image_1.hto this project. - Specify the image to be displayed.
Code Analysis
-
Load and display the image
gfx->draw16bitBeRGBBitmap(0, 0, (uint16_t *)gImage_img, 240, 280);
Operation Result
10_esp_wifi_analyzer
Example Description
- This example demonstrates the ESP32-C6-LCD-1.69 using the GFX_Library_for_Arduino library to display Wi‑Fi band signal strength.
Hardware Connection
- Connect the board to the computer using a USB cable.
Operation Result

11_pcf85063_example
Example Description
- This example demonstrates the ESP32-C6-LCD-1.69 obtaining the time and date from the PCF85063 and displaying them on the screen.
Hardware Connection
- Connect the board to the computer using a USB cable.
Operation Result
12_qmi8658_example
Example Description
- This example demonstrates the ESP32-C6-LCD-1.69 obtaining Accel, Gyro, and temperature data from the QMI8658 and displaying them on the screen.
Hardware Connection
- Connect the board to the computer using a USB cable.
Operation Result
13_lvgl_arduino_v8
Example Description
- This example demonstrates the ESP32-C6-LCD-1.69 running the LVGL v8 example.
Hardware Connection
- Connect the board to the computer using a USB cable.
Operation Result
14_lvgl_arduino_v9
Example Description
- This example demonstrates the ESP32-C6-LCD-1.69 running the LVGL v9 example.
Hardware Connection
- Connect the board to the computer using a USB cable.
Operation Result