First trial of Balancing robot based on Kristian Lauszus's code.

Dependents:   Balancing_Robot_2

Fork of MPU6050 by Baser Kandehir

Files at this revision

API Documentation at this revision

Comitter:
BaserK
Date:
Wed Aug 05 12:45:47 2015 +0000
Parent:
4:20f1f660e5c3
Child:
6:5b90f2b5e6d9
Commit message:
i2c object is no more extern

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	Wed Aug 05 12:17:44 2015 +0000
+++ b/MPU6050.cpp	Wed Aug 05 12:45:47 2015 +0000
@@ -161,7 +161,9 @@
 // Sample rate: 200Hz for gyro and acc
 // Interrupts are disabled
 void MPU6050::init()
-{        
+{      
+    i2c.frequency(400000);                      // fast i2c: 400 kHz
+  
     /* Wake up the device */
     writeByte(MPU6050_ADDRESS, PWR_MGMT_1, 0x00);  // wake up the device by clearing the sleep bit (bit6) 
     wait_ms(100); // wait 100 ms to stabilize  
--- a/MPU6050.h	Wed Aug 05 12:17:44 2015 +0000
+++ b/MPU6050.h	Wed Aug 05 12:45:47 2015 +0000
@@ -33,7 +33,6 @@
 #define PI 3.14159265359    // This value will be used when calculating angles
 #define dt 0.005            // 200 Hz sampling period
 
-extern I2C i2c;             // extern the i2c in order to able to use from other files
 extern float aRes, gRes; 
 
 /* whoAmI func uses this func, variables etc */