I found this on the web and after a few days of code shifting it works on a Mega2560.
This is not my code by a far stretch and I’m posting this because I haven’t seen it posted before. It gives an alternative to other libraries floating around that some people here might want to investigate.
The website is Kauai Labs releases port of latest Invensense MPU-6050/9150 driver to Arduino Platform | Kauai Labs - Robotics Sensors & Controllers
The code is written for their platform based on an Atmega128. It also has a compass function which I commented out.
I commented out some of the code and added some as indicated. I use MS VS with the vMicro addon. I use an xbee to transmit on Serial3. and the Serial Monitor on Serial. See attachments for jpegs.
It’s been running for hours and hasn’t stopped yet.
I haven’t figured it all out yet. It seems they can send info to the code to change parameters, also commented out.
Anyway, I have included everything in the attachment at Zippyshare.com - since it is 17 megs in size.