Introduction: Lab 6 - I2C Between Arduinos
Today we will be connecting two Ardunio microcontrollers and allowing connection through I2C.
For this instructable you will need:
2 Arduino Microcontrollers
2 breadboards
Jumper Wires (x12)
One Led (any color)
One button
Two 220 ohm resistors
Step 1: Step 1 - Setting the Arduinos Up
At this point you should have all of the required materials out. Both boards should be connected via the same ground (GND) and a jumper wire should run from each board's Analog 4 & 5.
Step 2: Step 2 - Connecting the Led
At this point both boards should be connected to each other's ground pin and Analog 4 & 5 pins. The master reader should have an LED connected to a breadboard. This led will be connected to the power rail, & the power rail will be connected to pin 13. A 220 ohm resistor is used to reduce the light's brightness. Lastly, the short end of the LED is connected to the ground (GND) rail.
Step 3: Step 3 - Connecting Button
On the slave sender side, the button needs to be placed. This button will be connected to a 5V power source and grounded using a 220 ohm resistor. From here, the button is connected to pin 8 (this allows us to send input).
Step 4: Step 4 - Sending/Receiving Inputs
At this point both boards should be connected properly. I have attached the source code which allows the two Arduinos to interact. While the button on the slave sender is pressed, one byte is sent signaling the master receiver to turn its LED on. While the button is both on and off, the master receiver consistently tells the slave sender the status of the light.
Comments
6 years ago
I2C not IC2