MPU6050 library that is kinda beta and will probably never leave beta but it might help some people.

Dependents:   BLE_temperature

Fork of MPU6050 by Erik -

Files at this revision

API Documentation at this revision

Comitter:
youyou
Date:
Tue Jun 10 04:52:01 2014 +0000
Parent:
2:5c63e20c50f3
Commit message:
MPU6050 to moble phone

Changed in this revision

MPU6050.cpp Show annotated file Show diff for this revision Revisions of this file
MPU6050.h Show annotated file Show diff for this revision Revisions of this file
--- a/MPU6050.cpp	Mon Sep 10 21:26:25 2012 +0000
+++ b/MPU6050.cpp	Tue Jun 10 04:52:01 2014 +0000
@@ -4,8 +4,7 @@
 #include "MPU6050.h"
 
 MPU6050::MPU6050(PinName sda, PinName scl) : connection(sda, scl) {
-    this->setSleepMode(false);
-    
+    //this->setSleepMode(false);
     //Initializations:
     currentGyroRange = 0;
     currentAcceleroRange=0;
@@ -23,6 +22,11 @@
     connection.write(MPU6050_ADDRESS * 2,temp,2);
 }
 
+void MPU6050::setFrequency(int hz)
+{
+    connection.frequency(hz);
+}
+
 char MPU6050::read(char address) {
     char retval;
     connection.write(MPU6050_ADDRESS * 2, &address, 1, true);
--- a/MPU6050.h	Mon Sep 10 21:26:25 2012 +0000
+++ b/MPU6050.h	Tue Jun 10 04:52:01 2014 +0000
@@ -16,7 +16,7 @@
  * Defines
  */
 #ifndef MPU6050_ADDRESS
-    #define MPU6050_ADDRESS             0x69 // address pin low (GND), default for InvenSense evaluation board
+    #define MPU6050_ADDRESS             0x68 // address pin low (GND), default for InvenSense evaluation board
 #endif
 
 #ifdef MPU6050_ES
@@ -92,7 +92,7 @@
      * @param scl - mbed pin to use for the SCL I2C line.
      */
      MPU6050(PinName sda, PinName scl);
-     
+     void setFrequency(int hz);
 
      /**
      * Tests the I2C connection by reading the WHO_AM_I register.