Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BNO055_fusion mbed MODSERIAL dsp
Fork of Bosch_BNO055_Fusion_example by
Revision 10:acbb851070c2, committed 2016-02-07
- Comitter:
- tommyallen
- Date:
- Sun Feb 07 22:21:26 2016 +0000
- Parent:
- 9:7be40e42e578
- Commit message:
- 07/02/16;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Feb 04 15:48:15 2016 +0000
+++ b/main.cpp Sun Feb 07 22:21:26 2016 +0000
@@ -32,7 +32,9 @@
volatile bool FUS = false;
bool printed = false;
int Time;
-int TimeStamp;
+int timeStamp = 0;
+int timeOfStart;
+int timeNow;
//string sdata = "";
@@ -79,6 +81,10 @@
FUS = false;
pc.printf("\r\nSWITCHING TO RAW DATA!\r\n");
}
+ if ( serial->rxGetLastChar() == '*') {
+ timeOfStart = t.read_ms();
+ timeStamp = 0;
+ }
}
//-------------------------------------------------------------------------------------------------
@@ -199,26 +205,26 @@
imu.write_reg0(0x3d, 0x07); // Default FUS
while (1) {
- while (RAW == true) {
+ while (RAW == true) {
Time = t.read_ms();
- if (Time > TimeStamp + 9) {
+ timeNow = Time + timeOfStart;
+ if (timeNow > 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;
+ pc.printf("Time:,%d,/",timeNow);
+ timeStamp = timeNow;
}
}
while (RAW == false) {
Time = t.read_ms();
- if (Time > TimeStamp + 9) {
+ timeNow = + Time - timeOfStart;
+ if (timeNow > 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;
+ pc.printf("FUS,Time:,%d,x:,%+6.1f,y:,%+6.1f,z:,%+6.1f, , , , , , , , , /"
+ ,timeNow,linear_acc.x ,linear_acc.y ,linear_acc.z);
+ timeStamp = timeNow;
}
}
}
