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

Question relating to:

Yifei Teng / FreeIMU Featured
10DOF FreeIMU port for FreeIMU v4 board and GY-86. This library was modified extensively to specifically suit the Mbed platform. Used threads and interrupts to achieve async mode.

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
Be the first to answer this question.