Hello experts ! Sorry to bother you but I’m suspecting we cannot catch mems values (acc and gyro) from an IKSO1A2 ST evaluation board using a callback routine? is it? Where am I doing wrong?
Let’s say… I know I can read values from accelerometer and gyro in main loop as written in “HelloWorld_IKS01A2” example…but it seems it doesn’t work if I do it in a callback function like this code:
// Main function
int main()
{
- uint16_t status = imu.begin(); *
- imu.calibrate(1);*
- start.attach(&read_acc_gyro, 0.01); // <–here I’d like to read values from mems with loop frequency 100Hz*
- while(1) { *
-
pc.printf("%f\n\r",speed); *
- }*
}
where “start” is a Ticker object of course and “read_acc_gyro” is a routine with inside:
[…]
accelerometer->get_x_axes_raw(accL);
- gyroscope->get_g_axes_raw(gyrL);*
[…]
Unlucky the code doesn’t work
so what do you think? Can I catch values in this way ?!?!?
Many thanks for your help and regards
Lorenzo.