This repository contains a simple I2C LCD driver for ESP32 microcontrollers written in C. The driver allows interfacing with I2C-enabled LCD screens using the ESP-IDF framework. Prerequisites
Before using this driver, ensure you have the ESP-IDF development environment set up on your system. You can find instructions on setting up the ESP-IDF framework here. Hardware Setup
Connect your I2C-enabled LCD screen to the ESP32 using the specified GPIO pins in the lcd_pins_t structure. Make sure to adjust the pin configuration according to your hardware setup.
Clone this repository to your local machine:
git clone https://github.com/abdellah2288/esp32-i2c-lcd-driver.git
Navigate to the project directory:
cd esp32-i2c-lcd-driver
Build and flash the code to your ESP32:
idf.py build flash
Define the GPIO pins used for 4-bit mode operations in the lcd_pins_t structure. Adjust the pin configuration according to your hardware setup.
esp_err_t i2c_master_init(void);
Use the provided functions to interact with the LCD:
i2c_lcd_init_sequence(int address);
i2c_lcd_send_command(int rs_state, int comm, int address);
i2c_lcd_write_message(char* msg, int address);
i2c_lcd_clear_screen(int address);
i2c_lcd_custom_char(int* pattern[], int location, int address);
i2c_lcd_shift_cursor(int x, int y, int direction, int address);
Contributions are welcome! If you find any issues or have improvements to suggest, please open an issue or submit a pull request.
This project is licensed under the GPL v2 license.