nDevices = 0;
for(address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
Serial.print("I2C device found at address 0x");
if (address<16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
}
else if (error==4)
{
Serial.print("Unknow error at address 0x");
if (address<16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
Reading the documenation, it seems that sometimes the usb power is not enough. Could you try with a power supply for the Arduino Uno ?
The schematic does not show how it is connected to the Arduino. It seems that the new I2C pins are used, those are only on the Arduino Uno V3. Do you have that, or an older version of the Uno ?
And there are jumpers for the accelerometer. Did you set those ?
The MMA8452Q has an I2C interface, so the i2c_scanner should be able to detect it, once it is connected.
hi all....
i need full tutorial about using i2c communication with 3 or more slaves. in my project i am using arduino due as master. and uno's as slaves. arduino due is connected with touch screen. and slaves connected to sensor. sensor values are continuously transferring to due for displaying. i used Wire.library. the project is working fairly.but not 100% good. some data are missing. the sensor values are floats. i used value/100 and value%100 method. then i heard about i2c anything and easyTransfer header files. both are tested.but sadly,not working. i couldnt implement slave sending by these methods. plzz help me.....