MPU6050/MPU6500/MPU9150/MPU9250 library over I2c

Here's some observations from my own experiments.

  1. My READ ERROR was an I2C thing. Probably because I'm on breadboard. Try:
Fastwire::setup(200,0);

in AvrCopter.ino L14. Worked for me.

  1. Once it goes wrong, it will freeze without recovering. You can check this by adding something like:
case 2: err_o++; Serial.println(err_o); return;

at L47

It is possible to recover from some buffer overflow freezes by clearing the FIFO buffer. To do this, add the following line to mpu.h:

int mympu_clearfifo();

then change L47 to this:

case 2: err_o++; ret = mympu_clearfifo(); err_o++; Serial.println(err_o); return;