Hi, I have a similar problem reading accel data from the sensor. I'm programmig in arm mbed compiler.
My code is:
int main()
{
while(1) {
i2c.frequency(400000);
char data_write[1];
data_write[0] = 0x01; OPERATION_MODE_ACCONLY;
i2c.write(BNO055_OPR_MODE_ADDR, data_write,1);
wait(1);
char data[2];
i2c.read(BNO055_I2C_ADDR2, data, 2);
wait(0.5);
char data_2[2];
i2c.read(BNO055_I2C_ADDR1, data_2, 2);
i2c.read(0x29, data, 6);
pc.baud (115200);
pc.printf("Comienza el bucle\r\n");
pc.printf("aceleracion 1: %d\r\n", data[0]);
pc.printf("aceleracion 2: %d\r\n", data[1]);
pc.printf("aceleracion 3: %d\r\n", data_2[0]);
pc.printf("aceleracion 4: %d\r\n", data_2[1]);
}
}
After reading accel data with i2c communication,:
aceleracion 1 = 0
aceleracion 2 = 128
aceleracion 3 = 0
aceleracion 4 = 128.
It's always the same values.
What is wrong?
Thanks
Hi, I have a similar problem reading accel data from the sensor. I'm programmig in arm mbed compiler. My code is:
int main() { while(1) {
i2c.frequency(400000); char data_write[1]; data_write[0] = 0x01; OPERATION_MODE_ACCONLY; i2c.write(BNO055_OPR_MODE_ADDR, data_write,1);
wait(1); char data[2]; i2c.read(BNO055_I2C_ADDR2, data, 2);
wait(0.5); char data_2[2]; i2c.read(BNO055_I2C_ADDR1, data_2, 2);
i2c.read(0x29, data, 6); pc.baud (115200); pc.printf("Comienza el bucle\r\n"); pc.printf("aceleracion 1: %d\r\n", data[0]); pc.printf("aceleracion 2: %d\r\n", data[1]);
pc.printf("aceleracion 3: %d\r\n", data_2[0]); pc.printf("aceleracion 4: %d\r\n", data_2[1]);
} }
After reading accel data with i2c communication,: aceleracion 1 = 0 aceleracion 2 = 128 aceleracion 3 = 0 aceleracion 4 = 128.
It's always the same values.
What is wrong?
Thanks