Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 7 months ago.
Can you add a start and stop sampling function please
Hi,
Your library works great but I need to write to a config file after I have initialised freeIMU. When I write to the config file the mbed locks up however if I write to the config file before initialising freeIMU it works great.
I think the tickers and threads within freeIMU are causing a conflict. Would it be possible to add a function that starts sampling all the sensors and a function that stops the sampling. Then I can pause the sampling, write to the config file and then start sampling again.
Thanks Joe
Hi,
I found it was this line causing the problem
void MPU6050::mpu_sample_func(){ i2Cdev.readBytes_nb(devAddr, &mpu_cmd, 14, (uint8_t*)mpu_buffer, &mpureadfin, this); }
I wrapped an if statement around and now have a flag that I set to enable and disable the accgyro sampling.
void MPU6050::mpu_sample_func(){ if(_sampling == true) { i2Cdev.readBytes_nb(devAddr, &mpu_cmd, 14, (uint8_t*)mpu_buffer, &mpureadfin, this); } }
Thanks Joe
posted by Joseph Roberts 09 May 2014