Example code for the ESP32 dev board known as the CYD or Cheap Yellow Display. AKA ESP32-2432S028, ESP32-2432S024R. This project is a beginner example. It is heavily commented code, and coded without classes or separate files. Every device on the board is used in this example, as well as LVGL for graphics.

This is for platform.io. Load the project files, and adjust platformio.ini to your needs. Switch between ILI9341 and ST7796 by commenting in/out the code you need in platform.io.
*Backlight
*TFT_eSPI display driver
*LVGL graphics
*LED toggle (random color)
*Speaker buzzer
*LDS/CdS/photoresistor light sensor
*XPT2040 Touchscreen
*SD/TF Card
esp32-2432s028-touch.mp4
esp32-2432s028-ldr-cds-light-sensor.mp4
Code from @AllanOricil helped a lot: https://github.com/AllanOricil/esp32-lvgl-lcd-touch-sd-card
LVGL: An open-source graphics library for creating embedded GUIs.
TFT_eSPI: A graphics library for ESP8266 and ESP32 that supports different TFT displays.
XPT2046_Bitbang: A library for interfacing with XPT2046 resistive touch controllers using bit-banging for SPI communication.
PlatformIO: Development platforms used for writing, compiling, and uploading the code to ESP32.