MPU6050 library that is kinda beta and will probably never leave beta but it might help some people.
diff -r 6757f7363a9f -r a3366f09e95c MPU6050.h --- a/MPU6050.h Wed Jul 11 12:26:47 2012 +0000 +++ b/MPU6050.h Mon Sep 10 21:22:39 2012 +0000 @@ -1,17 +1,4 @@ -/*My first library, and it only contains the basic what I required personally (or could be bothered to add) -WARNING: This does NOT include the IMU capabilities of the MPU6050. Simply because there is no register map available required for that, -it is not added to this library. You can google for some reverse engineered code, but that does not give you any idea what is going on. - - -Thanks to Uwe Gartman for having a nice example of a similar library (http://mbed.org/users/Digixx/libraries/ITG3200/lyptff) - -If you want a more complete library, check: https://github.com/jrowberg/i2cdevlib/tree/master/MPU6050 -This library contains alot less, but that also makes it less confusing ;) - -Large goal for me was getting experience with making libraries, which is a reason I did not copy the one from github (and adapt it for mbed). But if you just want to use the accelero -and gyroscope of this IC with a few settings, this library should be an easy choice. - -Use #define MPU6050_ES before you include this file if you have an engineering sample (older EVBs will have them), to find out if you have one, check your accelerometer output. +/*Use #define MPU6050_ES before you include this file if you have an engineering sample (older EVBs will have them), to find out if you have one, check your accelerometer output. If it is half of what you expected, and you still are on the correct planet, you got an engineering sample */ @@ -23,12 +10,15 @@ * Includes */ #include "mbed.h" -#include "MODI2C.h" + /** * Defines */ -#define MPU6050_ADDRESS 0x69 // address pin low (GND), default for InvenSense evaluation board +#ifndef MPU6050_ADDRESS + #define MPU6050_ADDRESS 0x69 // address pin low (GND), default for InvenSense evaluation board +#endif + #ifdef MPU6050_ES #define DOUBLE_ACCELERO #endif @@ -266,7 +256,7 @@ private: - MODI2C connection; + I2C connection; char currentAcceleroRange; char currentGyroRange;