Skip to main content

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.

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 NameDescriptionVersionInstallation Method
lvglLVGL graphics libraryv8.4.0Online or manual installation
GFX_Library_for_ArduinoGFX graphics libraryv1.6.0Online or manual installation
U8g2Graphics display libraryv2.35.30Online or manual installation
SensorLibSensor libraryv0.3.1Online or manual installation
OneButtonButton libraryv2.6.1Online or manual installation
Version Compatibility Notes

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:

  1. Navigate to the downloaded example package.

  2. Copy all folders (such as lvgl and lv_conf.h) from the arduino\libraries directory to the Arduino libraries folder.

    info

    The 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 libraries subfolder within this path.

  3. For other installation methods, please refer to: Arduino Library Management Tutorial.

3. Arduino Project Parameter Settings

[ESP32-C6-LCD-1.69]

Example

Arduino example

ExampleBasic DescriptionDependency Library
01_audio_outPlay PCM audio data via I2S interface-
02_button_exampleDisplay battery voltage on the screenOneButton
03_battery_exampleBOOT button single click, double click, long press, etc.OneButton
04_es8311_exampleReal‑time playback of microphone audio through speaker-
05_gfx_helloworldDisplay HelloWorld on the screenGFX_Library_for_Arduino
06_gfx_pdq_graphicstestGraphics performance test and score displayGFX_Library_for_Arduino
07_gfx_clockDisplay an analog clock face on the screenGFX_Library_for_Arduino
08_gfx_u8g2_fontLoad font libraries to display multilingual textGFX_Library_for_Arduino, U8g2
09_gfx_imageDisplay an image on the screenGFX_Library_for_Arduino
10_esp_wifi_analyzerDisplay Wi‑Fi band signal strength on the screenGFX_Library_for_Arduino
11_pcf85063_exampleDisplay RTC time on the screenGFX_Library_for_Arduino, SensorLib
12_qmi8658_exampleDisplay IMU data on the screenGFX_Library_for_Arduino, SensorLib
13_lvgl_arduino_v8LVGL v8 example programlvgl (v8.4.0), GFX_Library_for_Arduino, SensorLib
14_lvgl_arduino_v9LVGL v9 example programlvgl (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

  • Copy image_1.h to 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