7 years, 8 months ago.

Problem with times in Library MPU9150AHRS

Hi! I hope you can help me. I'm using the library MPU9150AHRS. But i need obtain the roll angle and the gyro values with more frecuency. I try modifying this line:

Serial print and/or display at 0.5 s rate independent of data rates delt_t = t.read_ms() - count; if (delt_t > 500) { update LCD once per half-second independent of read rate

I put for example 50 where this say 500 for obtain more frecuency in the values, but with thats i had wrongs values in the variables. Do you know how can i get more frecuency? Thanks a lot!

1 Answer

7 years, 8 months ago.

The main loop in the MPU9150AHRS library example code contains a number of pc.printf statements, which can be slow to execute. The printed output gets corrupted if you try to execute the loop faster than the serial printing can support.

1) Increase the serial port baud rate. The example code sets the baud rate to 9600. You should have no problem increasing it to at least 152000.

2) Comment out any pc.printf statements in the main loop that you do not need.

Accepted Answer