02-06-2020 03:00 AM
Dear All,
Great to know this community.
This is the first time to work with the Bosch sensor.
I'm trying to find out a way to get the tilted angle of BMI160.
If you have any source code or application notes for that, let me get it, please.
Thanks for your help in advance.
Solved! Go to Solution.
02-06-2020 07:28 AM
I think there are loads of examples for calculating the angle from accelerometer (gravity) values. Perhaps something like this will explain? http://www.hobbytronics.co.uk/accelerometer-info
I haven't tried this code myself though.
To get the accelerometer values you can do something like this:
u8 int_data[6] = {0, 0, 0, 0, 0, 0};
s16 acc_x, acc_y, acc_z;
bmi160_get_regs(0x12, &int_data, 6, dev);
acc_x = ((int_data[1] << 8 | int_data[0]));
acc_y = ((int_data[3] << 8 | int_data[2]));
acc_z = ((int_data[5] << 8 | int_data[4]));
02-10-2020 10:04 AM
Appreciate for your help.