This is a simple template project to make it easier to use the Waveshare ESP32 1.69" Touch Display with LVGL (Light and Versatile Graphics Library).
I created this template to help get started quickly with the basic setup and functions.
- LVGL support
- Basic screen brightness control
- Short and double touch press callbacks
- Simple tone output support
- Periodic update via
Ticker
void setBrightness(uint8_t brightness);
Set screen brightness (0–255).
void setShortPressCallback(ButtonCallback cb);
Set a callback for short press events.
void setDoublePressCallback(ButtonCallback cb);
Set a callback for double press events.
void toneOut(int pitch, int duration);
Play a tone using defined pitch and duration (in ms).
Example pitch constants (defined in tone.h
):
#define TONE_AN 220 // A
#define TONE_AS 233 // A#
#define TONE_BN 247 // B
#define TONE_CN 261 // C
#define TONE_CS 277 // C#
#define TONE_DN 294 // D
#define TONE_DS 311 // D#
#define TONE_EN 330 // E
#define TONE_FN 349 // F
#define TONE_FS 370 // F#
#define TONE_GN 392 // G
#define TONE_GS 415 // G#
Use FreeRTOS tasks for periodic updates:
TaskHandle_t otherTaskHandle = NULL;
void otherTask(void *parameter)
{
static long counter = 0;
while (1)
{
counter = millis() / 1000;
String str = "Counter" + String(counter);
lv_label_set_text(label, str.c_str()); // Update the label text
vTaskDelay(1000 / portTICK_PERIOD_MS); // Delay for 1 second
}
}
xTaskCreatePinnedToCore(
otherTask, // Task function
"Other Task", // Task name
2048, // Stack size (words)
NULL, // Parameters
1, // Priority (1 is usually enough)
&otherTaskHandle, // Task handle
0 // Core 0 or 1 (0 is good for simple tasks)
);
- Display: Waveshare 1.69" Touch LCD
- Board: ESP32-based (e.g., ESP32-S3)
Product page: Waveshare ESP32-S3 Touch LCD 1.69"
Wiki/documentation: Waveshare Wiki
- Clone this repo
- Set up your ESP32 dev environment (PlatformIO or Arduino IDE)
- Flash to your board and start building your UI!
MIT License – free to use and modify.
If you find this project helpful, you can buy me a coffee ☕
For work inquiries or collaborations, reach out via email: nguyenleybme@gmail.com