Regarding UNO

How to find address of arduino uno for I2C . in wire library it is defined as 4(master reader),2(master write) what it means?

Hi salaideva

Do you mean the I2C address of the Arduino when it is working as a slave?

For a slave, you specify the address in your program:

Wire.begin(42); // initialise as I2C slave with 7-bit address of 42 decimal



But if u see the arduino->examples->wire master reader address is 2 while in arduino->examples->wire writer address is 4 :| :|

The “master_reader” example is the I2C master. It is meant to work with the “slave_sender” example program as the I2C slave.

The “slave_sender” program includes this:

Wire.begin(2);                // join i2c bus with address #2

The people who wrote the program chose 2 as the address. So “master_reader” has to match it:

Wire.requestFrom(2, 6);    // request 6 bytes from slave device #2

Instead of 2, they could have used any valid 7-bit I2C address that is not being used by another slave device on the same I2C bus. The important thing is that the same address is used in both programs.

For “master_writer” and “slave_receiver”, they chose address 4.