added main and defined M_PI

Dependencies:   BNOWrapper

Revision:
5:eefbf579d5cc
Parent:
4:ecd3871549e8
Child:
7:b548a684290d
--- a/main.cpp	Mon Jul 29 16:56:33 2019 +0000
+++ b/main.cpp	Tue Jul 30 16:44:23 2019 +0000
@@ -3,38 +3,39 @@
 
 int main()
 {
-    Serial pc(USBTX, USBRX, 115200);
+    Serial pc(USBTX, USBRX, 192000);
+    
 
     // Create IMU, passing in output stream, pins, I2C address, and I2C frequency
     // These pin assignments are specific to my dev setup -- you'll need to change them
-    BNO080 imu(&pc, PB_7, PB_6, D12, PA_11, 0x4b, 400000);
+    BNO080 imu(&pc, D4, D5, D12, D10, 0x4b, 100000);
 
     imu.begin();
 
     // Tell the IMU to report rotation every 100ms and acceleration every 200ms
+    
+    imu.enableReport(BNO080::TOTAL_ACCELERATION, 100);
+    //imu.enableReport(BNO080::GRAVITY_ACCELERATION, 100);
     imu.enableReport(BNO080::ROTATION, 100);
-    imu.enableReport(BNO080::TOTAL_ACCELERATION, 200);
 
     while (true) {
         wait(.001f);
 
         // poll the IMU for new data -- this returns true if any packets were received
+
         if(imu.updateData()) {
             // now check for the specific type of data that was received (can be multiple at once)
-            if (imu.hasNewData(BNO080::ROTATION)) {
-                // convert quaternion to Euler degrees and print
-                pc.printf("IMU Rotation Euler: ");
+            if (imu.hasNewData(BNO080::TOTAL_ACCELERATION) || imu.hasNewData(BNO080::ROTATION)) {
+                pc.printf("Total Accel: ");
+                imu.totalAcceleration.print(pc, true);
+                
+                pc.printf(", Rotation:");
                 TVector3 eulerRadians = imu.rotationVector.euler();
                 TVector3 eulerDegrees = eulerRadians * (180.0 / M_PI);
                 eulerDegrees.print(pc, true);
                 pc.printf("\n");
             }
-            if (imu.hasNewData(BNO080::TOTAL_ACCELERATION)) {
-                // print the acceleration vector using its builtin print() method
-                pc.printf("IMU Total Acceleration: ");
-                imu.totalAcceleration.print(pc, true);
-                pc.printf("\n");
-            }
+            
         }
     }