C code demonstrating I2C communication between two Arduino boards (UNO or Nano) using ATmega328P microcontrollers.
The project implements a master-slave setup, where the master reads the state of a button and sends it over I2C to the slave, which displays the button status on a 20×4 LCD display.
This project provides a simple example of inter-microcontroller communication using the I2C protocol.
- Master: Reads a button input, sends the button state to the slave, and controls the I2C communication.
- Slave: Receives the button state and displays the status on a 20×4 LCD as either
"Btn. pressed"or"Btn. not pressed".
It is designed for educational purposes and to demonstrate I2C functionality in embedded systems.
- Master-slave I2C communication
- Button state reading and transmission
- Displaying received data on 20×4 LCD
- Modular and reusable code structure
- Tested with Arduino UNO / Nano boards
- Microcontrollers: ATmega328P (Arduino UNO/Nano)
- Development environment: Atmel Studio
- Display: LCD 20×4 (HD44780-compatible)
- Input: Push-button connected to master MCU
- Connect the master and slave boards via I2C (SDA and SCL lines).
- Connect a push-button to the master board.
- Connect the 20×4 LCD to the slave board using the LCD library.
- Load the master code on one board and the slave code on the other.
- Press the button on the master board; the slave will display the button state on the LCD.
Refer to the source files for function definitions and configuration details.
✔️ Stable — tested on Arduino UNO/Nano boards with 20×4 LCD.
This project is open-source and intended for educational and embedded development use.
