This repository demonstrates how to use ESP-IDF 5.4.1 with a new I2C driver to control an HD44780 2004A LCD via a PCF8574 I2C I/O expander.
- ESP-IDF 5.4.1: Utilizing the latest ESP-IDF framework.
- I2C Driver: Includes a new I2C driver for improved communication.
- LCD Display: Control an HD44780 2004A LCD display.
- PCF8574 I/O Expander: Interface with the LCD using a PCF8574 I2C I/O expander.
- ESP32 Development Board
- HD44780 2004A LCD Display
- PCF8574 I2C I/O Expander
- ESP-IDF 5.4.1 or later
-
Clone the Repository
git clone https://github.com/tolacika/esp-lcd-example.git cd esp-lcd-example
-
Set Up ESP-IDF Follow the ESP-IDF Getting Started Guide to set up the ESP-IDF environment.
-
Build and Flash
idf.py build idf.py flash
-
Monitor
idf.py monitor
This example initializes the I2C driver and configures the HD44780 2004A LCD display via the PCF8574 I2C I/O expander. The code demonstrates basic LCD operations such as clearing the display, writing text, and setting the cursor position.
- main/lcd.c: Contains the implementation for the LCD functions.
- Initializes the I2C master and the LCD display.
- Provides functions to set the cursor, write strings, clear the display, and control the backlight.
- main/lcd.h: Header file for the LCD functions.
- Defines constants and function prototypes for LCD operations
Contributions are welcome! Please fork this repository and submit pull requests for any improvements.
This project is licensed under the MIT License. See the LICENSE file for details.