A question to change the sample rate in MPU6050.h file

Dear all,

I am working on a small project and need to have the sample rate up to 50Hz. I ran to a thread in Arduino Forum community and someone said that he was able to change a setting from 0x0A to 0x03 in MPU6050.h (Jeff’s MPU6050 raw code) to have the sample rate moved up from 18Hz to 50Hz. I am not able to locate that line of code in mpu6050.h file. You can click the link to see the file. (i2cdevlib/MPU6050.h at master · jrowberg/i2cdevlib · GitHub) I am currently using your MPU6050 raw code. It works great for me. The thread is here.

Thank you all.


Call the setRate() method perhaps?

Thanks, Mark.

How should I call the setRate()? Sorry, I am a very rookie that doesnt have any experiencing in actual coding. Do I first need to find the setRate() in the MPU6050.h file? Thanks again.

Anybody have ideas about how to do this? Thanks ahead.

There is a sticky at the top of the forum that discusses how to ask a question on the forum. On this forum, you need to post your code.

At least defining what a MPU6050 is would be helpful. You have one, so you know what it is. When YOU are asking for help, why do you expect us to google it?

How should I call the setRate()?

Have you even looked at the library to see what that function does? What it's default value is?

Hi Paul,

Sorry for such an inconvenience. I tried to post the code in my original message. But the forum didn’t allow me to upload it and warned me that the code was too long. That is why I chose an alternative to attach a link here. This link is right into the MPU6050.h code.

A little details about MPU6050: it is a triaxial accelerometer/gyro sensoing platform and is released from Sparkfun. https://www.sparkfun.com/products/11028

Here I attach the whole package of execution codes here for my project. This project uses Arduino ProMini 328 3.3V/8MHz to read data from MPU6050. Arduino ProMini is connected to my laptop which uses serial monitor to track the data input from MPU6050.

The running code is MPU6050_raw_1.ino. The embedded code for MPU6050 chip is MPU6050.cpp and MPU6050.h. And the rest of them are embedded codes for I2C bus.

Sorry I am really new to programming. I would apologize again for any ignorance and inconvenience my actions have caused along the way.


MPU6050_raw_1.zip (44.2 KB)