loading

I2C in arduino

Hi,

I am trying to connect two arduino UNO together. Lets call one U1 and the other U2. U1 is master and U2 is slave. Now I want to attach a wave shield to U2 which is slave and operate it from U1. Is that possible?

If it is possible, then can I use any pin to transmit and receive signal?? Cause in some forums they say that I2C is done by using digital pin 4 and 5. However, these pins are taken by wave shield. So please help me out in this.

sort by: active | newest | oldest
JimmyK22 years ago

Hi..i'm trying to connect two inputs by using the same library,which is Wire.h, which means that using the same port..but i can't display the expected output both of them at my LCD..the two inputs are ADXL345 3-Axis Accelerometer and DS1307 RTC..

Please help me..really desperate here..thanks

www.instructables.com/id/I2C-between-Arduinos/


www.youtube.com/watch?v=Jndb2vpAWwU
sath024 years ago
There are three type of communication protocols available with Arduino -
I2C (pin A4, A5),
UART (Serial Comm.) (pin D0 and D1) and
SPI (pin D11, D12, D13 and any Digital pin, usually pin D10).
And you can use any of these protocol to communicate between two Arduinos.

If you want to use I2C for communication between two Arduinos, you probably need to use pin A4 and A5.

Here is the good example of two Arduinos connecting to each other using I2C communication and one of the Arduinos connects to wave shield.
https://www.instructables.com/id/Build-an-Arduino-powered-talking-robot-head/
Why use I2C ? Just use bit-banged SPI.
lewisb424 years ago
I2C is analog pins 4 and 5 (aliased in the Arduino environment to digital pins A4 and A5) and if you want to use the hardware I2C implementation you have to use those pins.

It appears there are software implementations of I2C for Arduino that let you make any two digital pins an I2C bus, for example: http://rweather.github.com/arduinolibs/classSoftI2C.html

I haven't used any of those, so I have no idea how well they work.