added main and defined M_PI

Dependencies:   BNOWrapper

Revision:
10:14374b492f1d
Parent:
8:729ad465d6c9
--- a/main.cpp	Wed Aug 07 17:26:41 2019 +0000
+++ b/main.cpp	Wed Aug 07 18:50:14 2019 +0000
@@ -1,6 +1,7 @@
 #include <mbed.h>
 #include <BNO080.h>
 #include "Watchdog.h"
+#include <BNO080Wheelchair.h>
 
 int main()
 {
@@ -10,35 +11,32 @@
     //BNO080 imu(&pc, D4, D5, D12, D10, 0x4b, 100000);
 
     //NUCLEO- F767ZI
-    BNO080 imu(&pc, D2, D4, D13, D15, 0x4b, 100000);
+    BNO080Wheelchair imu(&pc, D2, D4, D13, D15, 0x4b, 100000);
 
 
     Watchdog dog(&imu);
     dog.Configure(4);         //need to find the time for entire program to run
-    imu.begin();
+    imu.setup();
     // Tell the IMU to report rotation every 100ms and acceleration every 200ms
 
-    imu.enableReport(BNO080::TOTAL_ACCELERATION, 100);
-    imu.enableReport(BNO080::ROTATION, 100);
+    // imu.enableReport(BNO080::TOTAL_ACCELERATION, 100);
+    // imu.enableReport(BNO080::ROTATION, 100);
 
     while (true) {
         wait(.001f);
 
         // poll the IMU for new data -- this returns true if any packets were received
-        if(imu.updateData()) {
+        if(imu.hasNewData(BNO080::TOTAL_ACCELERATION)) {
             // now check for the specific type of data that was received (can be multiple at once)
-            if (imu.hasNewData(BNO080::TOTAL_ACCELERATION) || imu.hasNewData(BNO080::ROTATION)) {
-                pc.printf("TAcc: ");
-                imu.totalAcceleration.print(pc, true);
+
+            pc.printf("Acc in X: %f\n", imu.accel_x());
 
-                pc.printf(", Rot:");
-                TVector3 eulerRadians = imu.rotationVector.euler();
-                TVector3 eulerDegrees = eulerRadians * (180.0 / M_PI);
-                eulerDegrees.print(pc, true);
-                pc.printf("\n");
-
-                dog.Service();
-            }
+            pc.printf("Rot in X: ");
+            TVector4 eulerRadians = imu.rotation();
+            TVector4 eulerDegrees = eulerRadians * (180.0 / M_PI);
+            eulerDegrees.print(pc, true);
+            pc.printf("\n");
+            dog.Service();
 
         }
     }