Hi Ji,
I think it's a function called setRate. It's defined in mpu6050.h and incorporated in mpu6050.cpp. But it seems it is not called for in the MPU6050 Raw example. I would put it in initialize,
I'm using the DMPexample, also without interrupt. What I understood is that MPU6050 sample frequency should be higher as the polling frequency. I,m testing on MPUint bit from the interrupt status register, and that seems to work.
Like this:
mpuIntStatus = mpuL.getIntStatus(); // get int status
fifoCount = mpuL.getFIFOCount();
if (mpuIntStatus & 0x02) {
while (fifoCount < packetSize) fifoCount = mpuL.getFIFOCount();
mpuL.getFIFOBytes(fifoBuffer, packetSize);
fifoCount -= packetSize;
mpuL.dmpGetQuaternion(&q, fifoBuffer);
mpuL.dmpGetYawPitchRoll(ypr, &q, &gravity);
mpuL.dmpGetAccel(&aa, fifoBuffer);
mpuL.dmpGetGravity(&gravity, &q);
mpuL.dmpGetLinearAccel(&aaReal, &aa, &gravity);
mpuL.dmpGetLinearAccelInWorld(&aaWorld, &aaReal, &q);
Buffer[0] = ypr[0] * 180/M_PI;
Buffer[1] = ypr[1] * 180/M_PI;
Buffer[2] = ypr[2] * 180/M_PI;
Buffer[3] = aaWorld.x;
Buffer[4] = aaWorld.y;
Buffer[5] = aaWorld.z;
mpuL.resetFIFO();
// export it to pure data stuff
}
}
my sample rate is 200 Hz, polling frequency about 10 Hz.
But I'm not sure or the DMP uses all information in the FIFO. Maybe Jeff knows??
Greetings, Pam