Hi, i'm trying to read data from a IMU (inertial movement unit http://www.sparkfun.com/datasheets/Sensors/Accelerometer/ADXL345.pdf
which commuicates with the I2C protocol to my arduino uno.
I'm using the following code:
// z-axis accelerometer
Wire.beginTransmission(0xA6); // the last bit of the address is write
Wire.send(0x36); //arduino seeks the correct register (z-axis value)
Wire.requestFrom(0xA7,1); //arduino requests the value from the register of z-axis
//the last bit of the address is read
a=Wire.receive(); //the slave (IMU) sends the data
I can't understand why the serial output of arduino is always 0. i made the correct links and i don't know if the mistake is about the serial.println part or about the I2C protocol part.
Could someone help me??