Simple step tracking

Dependencies:   MPU9250 mbed-os

Fork of ST by alonso palomino

Files at this revision

API Documentation at this revision

Comitter:
EdsonAlcala
Date:
Sun Oct 22 14:47:11 2017 +0000
Parent:
10:f5cd99dd9efa
Commit message:
last version

Changed in this revision

ButtonService.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/ButtonService.h	Fri Oct 20 19:01:23 2017 +0000
+++ b/ButtonService.h	Sun Oct 22 14:47:11 2017 +0000
@@ -59,27 +59,27 @@
         copy(pitchValue, pitchValue + 4, result + 4);
         copy(yawValue, yawValue + 4, result + 8);
         
-        //copy(gxValue, gxValue + 2, result + 12);
-        //copy(gyValue, gyValue + 2, result + 14);
-        //copy(gzValue, gzValue + 2, result + 16);
+        copy(gxValue, gxValue + 2, result + 12);
+        copy(gyValue, gyValue + 2, result + 14);
+        copy(gzValue, gzValue + 2, result + 16);
         
-        uint8_t gxLowerValue = gx & 0xff;
-        uint8_t gxHighValue = gx >> 8
+        //uint8_t gxLowerValue = gx & 0xff;
+        //uint8_t gxHighValue = gx >> 8
         
-        uint8_t gyLowerValue = gy & 0xff;
-        uint8_t gyHighValue = gy >> 8
+        //uint8_t gyLowerValue = gy & 0xff;
+        //uint8_t gyHighValue = gy >> 8
         
-        uint8_t gzLowerValue = gz & 0xff;
-        uint8_t gzHighValue = gz >> 8
+        //uint8_t gzLowerValue = gz & 0xff;
+        //uint8_t gzHighValue = gz >> 8
         
-        result[13] = gxLowerValue;
-        result[14] = gxHighValue;
+        //result[13] = gxLowerValue;
+        //result[14] = gxHighValue;
         
-        result[15] = gyLowerValue;
-        result[16] = gyHighValue;
+        //result[15] = gyLowerValue;
+        //result[16] = gyHighValue;
         
-        result[17] = gzLowerValue;
-        result[18] = gzHighValue;
+        //result[17] = gzLowerValue;
+        //result[18] = gzHighValue;
                 
         ble.gattServer().write(buttonState.getValueHandle(), (uint8_t *)result, sizeof(result));
     }
--- a/main.cpp	Fri Oct 20 19:01:23 2017 +0000
+++ b/main.cpp	Sun Oct 22 14:47:11 2017 +0000
@@ -125,10 +125,7 @@
             float gy = gyroscope[1] * 250.0 / 32768.0;
             float gz = gyroscope[2] * 250.0 / 32768.0;
             
-            uint8_t *gzValue;
-            gzValue = reinterpret_cast<uint8_t*>(&gz);
-            pc.printf("%f, %f, %f, %f, %f, %f \n", roll, pitch, yaw, gx, gy, gz);                                    
-            //buttonServicePtr->updateButtonState(roll, pitch, yaw, gx, gy, gz);       
+            pc.printf("%f, %f, %f, %f, %f, %f \n", roll, pitch, yaw, gx, gy, gz);        
             buttonServicePtr->updateButtonState(roll, pitch, yaw, gyroscope[0], gyroscope[1], gyroscope[2]);      
         }
         ble.waitForEvent();