Professional Documents
Culture Documents
What happen if you have a project with inputs and outputs more than your microcontroller can
handle ?
you can buy another microcontroller with larger input / output pins ( and this is a solution i don't
advise you to use as it will be expensive and hard to solder it in your board) or you can use two
smaller (less number of inputs /outputs) microcontrollers and connect them together to sent data
or commands to each other and this is the solution we are going to discuss in this post.
In this post we are going to connect two arduino boards using I2C .
I2C - I2C Requires Analog Pins 4 and 5 and two pull-up resistors. You can connect more than
100 Arduino's on the same 2 pins. It's simple, reliable and easy-to-use.
HOW TO PROGRAM :
We need to include the Wire library. This contains all the commands we need for using I2C.
For the Master:
Simply use Wire.begin() to start the I2C Bus on this Arduino as a Master.
For the Slave:
Use Wire.begin(address) to start the I2C Bus as a Slave.
In the master program :
The master sends 0 and then after a delay of two seconds it sends 1 .
In the slave program :
The slave has address 5 and if the data sent was zero it will blink LED_1 and if the data sent was
one it will blink LED_2 .
you can download the master and the slave programs and the simulation file using proteus from
the following link :
I2C programs and simulation using proteus
If you want to learn how to simulate arduino sketches using proteus click here