IMU problem - I2C

cattledog:

I2C_write(GYRO_ADDRESS, 0x39, 0b00000000);

I am concerned about this. 0x38 is the largest value of an actual data register.

I have no freaking idea what I tried to achieve with this write command. I deleted it.

However, I found oomething very interesting: When I read the two bytes with two seperate read commands they come out differet from one another and even look as if they might be correct!

inline float getRotation()
{
    int temp = I2C_read(GYRO_ADDRESS, 0x29, 1) << 8 | I2C_read(GYRO_ADDRESS, 0x28, 1) ;
    Serial.println(temp*GYRO_SENSIBILITY500);
}

Putput:

0
203
3.55
0
211
3.69
0
208
3.64

I think the values aren't zero becuase I havn't callibrated the gyro yet. The question now is: Why da f**** does it behave like that?

In any case I want to thank you a thousand times for your help and that you answered so many times! (=