

Wire. Serial.begin(9600) // start serial for output Wire.begin() // join i2c bus (address optional for master) This example code is in the public domain. Refer to the "Wire Slave Sender" example for use with this Reads data from an I2C/TWI slave device slave is just to send 6 bytes ("Hello ") to master when prompted. Here is the code which is just copy pasted from Wire library examples ( master reader for master arduino and slave sender for slave arduino.

Master sends data seamlessly ( although here master is just reading but i was able to send data from master to slave successfully) but when master requests data from slave it does not get desired response. i have assessed that problem is in requestEvent function of slave as that either doesnt send anything.

Problem only appears when master requests data from another arduino slave (master sends data successfully to slave arduino but vice versa is not true). Definitely there is something wrong with my approach. Unable to do what i was upto i resorted to example sketches of Wire library to assess what i was doing wrong and to my surprise even example sketches were not working. I am not able to receive bytes from slave arduino. Arduino Code LiquidCrystalI2C lcd(0x27, 16, 2) // I2C address 0x27, 16 column and 2 rows void setup() void loop() delay(2000) // display the above for. then i wanted to establish i2c communication between 2 arduinos such that both exchange each other's sensors data. This Arduino I2C tutorial explains the I2C pins in Arduino, configure Master and Slave and finally a simple demonstration in which two Arduino UNO board communicates over I2C. I tried i2c EPROM and that worked pretty fine with arduino master. JanuRavi Teja In this tutorial, we will see how to setup and use I2C Communication on Arduino.
