Inter-Integrated Circuit or I2C is a multi-master, multi-slave, single-ended, serial computer bus invented by Philips Semiconductor (now NXP Semiconductors). It is typically used for attaching lower-speed peripheral ICs to processors and microcontrollers in short-distance, intra-board communication.
In my example I made an I2C bus using two Arduinos. We will program one master Arduino to command the other slave Arduino by sending it different characters.
In order to build this I used the following parts:
I2c it's a 2 wire protocol for a 7-bit addressing bus. and it's using the SDA line for data transfer, and SLC the clock line.
Board I2C pins:
The following code is split in two parts: the master code and the slave code, which run on two different Arduinos. First, let's take a look at the master code:
And here is the slave code that interprets the characters sent from the master: