v1.0

Dependencies:   BNO055_fusion mbed MODSERIAL dsp

Fork of Bosch_BNO055_Fusion_example by Kenji Arai

Revision:
9:7be40e42e578
Parent:
8:41d1f9ab3be0
Child:
10:acbb851070c2
--- a/main.cpp	Wed Feb 03 14:52:21 2016 +0000
+++ b/main.cpp	Thu Feb 04 15:48:15 2016 +0000
@@ -20,6 +20,7 @@
 #include    "mbed.h"
 #include    "BNO055.h"
 #include    "MODSERIAL.h"
+#include    "arm_math.h"
 
 //  Definition ------------------------------------------------------------------------------------
 #define NUM_LOOP    100
@@ -30,6 +31,8 @@
 volatile bool RAW = true;
 volatile bool FUS = false;
 bool printed = false;
+int Time;
+int TimeStamp;
 
 //string sdata = "";
 
@@ -197,18 +200,26 @@
 
     while (1) {
         while (RAW == true) {
-            pc.printf("RAW,xLSB:,%d,xMSB:,%d,yLSB:%d,yMSB:,%d,zLSB:,%d,zMSB:,%d,"
-                      ,imu.read_reg0(0x08),imu.read_reg0(0x09)
-                      ,imu.read_reg0(0x0A),imu.read_reg0(0x0B)
-                      ,imu.read_reg0(0x0C),imu.read_reg0(0x0D));                      
-            pc.printf("Time:,%d,/",t.read_ms());
+            Time = t.read_ms();
+            if (Time > TimeStamp + 9) {
+                pc.printf("RAW,xLSB:,%d,xMSB:,%d,yLSB:%d,yMSB:,%d,zLSB:,%d,zMSB:,%d,"
+                          ,imu.read_reg0(0x08),imu.read_reg0(0x09)
+                          ,imu.read_reg0(0x0A),imu.read_reg0(0x0B)
+                          ,imu.read_reg0(0x0C),imu.read_reg0(0x0D));
+                pc.printf("Time:,%d,/",t.read_ms());
+                TimeStamp = Time;
+            }
         }
         while (RAW == false) {
-            imu.get_linear_accel(&linear_acc);
-            pc.printf("FUS,x:,%+6.1f,y:,%+6.1f,z:,%+6.1f,"
-                      ,linear_acc.x ,linear_acc.y ,linear_acc.z
-                      ,t.read_ms());          
-            pc.printf("Time:,%d,/",t.read_ms());
+            Time = t.read_ms();
+            if (Time > TimeStamp + 9) {
+                imu.get_linear_accel(&linear_acc);
+                pc.printf("FUS,x:,%+6.1f,y:,%+6.1f,z:,%+6.1f,Total:,%+6.1f,"
+                          ,linear_acc.x ,linear_acc.y ,linear_acc.z
+                          ,t.read_ms());
+                pc.printf("Time:,%d,/",t.read_ms());
+                TimeStamp = Time;
+            }
         }
     }
 }
@@ -225,7 +236,6 @@
 //                      gravity.x, gravity.y, gravity.z);
 //
 //            pc.printf("Time:,%d,\r\n",t.read_ms());
-
 //        imu.get_Euler_Angles(&euler_angles);
 //        pc.printf("[E],Y,%+6.1f,R,%+6.1f,P,%+6.1f,",
 //                   euler_angles.h, euler_angles.r, euler_angles.p);