Acceleration in meter per second square

Fork of MPU6050 by Baser Kandehir

Files at this revision

API Documentation at this revision

Comitter:
mbedproject
Date:
Wed Jun 15 22:28:32 2016 +0000
Parent:
7:c9f95ebeb780
Commit message:
Hexcopter_IMU_distance_v1;

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
diff -r c9f95ebeb780 -r 0e3519559bcb MPU6050.cpp
--- a/MPU6050.cpp	Sat May 14 05:32:28 2016 +0000
+++ b/MPU6050.cpp	Wed Jun 15 22:28:32 2016 +0000
@@ -59,6 +59,7 @@
 // Sensor datas
 float ax,ay,az;
 float gx,gy,gz;
+float axx;
 int16_t accelData[3],gyroData[3],tempData;
 float accelBias[3] = {0, 0, 0};  // Bias corrections for acc
 float gyroBias[3] = {0, 0, 0};   // Bias corrections for gyro 
@@ -142,15 +143,15 @@
 void MPU6050::checkaddress()
 {
     uint8_t checkaddress = readByte(MPU6050_ADDRESS, CHECKADDRESS_MPU6050);   // Should return 0x68
-    pc.printf("I AM 0x%x \r\n",checkaddress);
+    pc.printf("Sensor Address ID: 0x%x \r\n",checkaddress);
     
     if(checkaddress==0x68)
     {
-        pc.printf("MPU6050 is connected... \r\n");  
+        pc.printf("IMU is online now... \r\n");  
     }
     else
     {
-        pc.printf("No connection to MPU6050 !! Check the connections... \r\n");  
+        pc.printf("No connection to IMU !! Check the connections... \r\n");  
     }  
 }
 
@@ -353,6 +354,8 @@
     ax = accelData[0]*aRes - accelBias[0];
     ay = accelData[1]*aRes - accelBias[1];
     az = accelData[2]*aRes - accelBias[2]; 
+    
+    axx = 9.80665f * ax;
 
     /* Get actual gyro value */
     readGyroData(gyroData);
diff -r c9f95ebeb780 -r 0e3519559bcb MPU6050.h
--- a/MPU6050.h	Sat May 14 05:32:28 2016 +0000
+++ b/MPU6050.h	Wed Jun 15 22:28:32 2016 +0000
@@ -46,6 +46,7 @@
 extern float gx,gy,gz;
 extern int16_t accelData[3],gyroData[3],tempData;
 extern float accelBias[3], gyroBias[3];
+extern float axx;
  
 /* Function Prototypes */
 class MPU6050