![](/media/cache/profiles/TAG-avatar.png.50x50_q85.png)
Example/test programs for my BNO080 driver.
BNO080 Driver Examples
These examples show how to use some of the functionality on my BNO080 driver. To get started with MBed CLI:
Build Instructions
$ hg clone https://MultipleMonomials@os.mbed.com/users/MultipleMonomials/code/BNO080-Examples/ $ cd BNO080-Examples $ mbed deploy $ mbed compile
Diff: BNOTestSuite.cpp
- Revision:
- 3:f72d98d0095e
- Parent:
- 1:14c135ea7134
- Child:
- 4:85b98cc04a0a
--- a/BNOTestSuite.cpp Thu Jan 30 03:20:09 2020 -0800 +++ b/BNOTestSuite.cpp Mon May 04 03:04:11 2020 -0700 @@ -6,11 +6,13 @@ #include "BNOTestSuite.h" +#include <cinttypes> + #define RAD_TO_DEG (180.0/M_PI) void BNOTestSuite::test_printInfo() { - pc.printf("BNO080 reports as SW version %hhu.%hhu.%hu, build %lu, part no. %lu\n", + pc.printf("BNO080 reports as SW version %" PRIu8 ".%" PRIu8 ".%" PRIu16", build %" PRIu32 ", part no. %" PRIu32"\n", imu.majorSoftwareVersion, imu.minorSoftwareVersion, imu.patchSoftwareVersion, imu.buildNumber, imu.partNumber); } @@ -26,7 +28,7 @@ { // note: for some reason it seems like wait() here waits 10x the time you tell it to // not sure what's causing this behavior, and I don't see it with mbed os 2 - wait(.0001f * update_rate_ms); + ThisThread::sleep_for(update_rate_ms); if(imu.updateData()) { @@ -54,7 +56,7 @@ while (true) { - wait(.001f); + ThisThread::sleep_for(1); if(imu.updateData()) { @@ -104,7 +106,7 @@ { // note: for some reason it seems like wait() here waits 10x the time you tell it to // not sure what's causing this behavior, and I don't see it with mbed os 2 - wait(.0001f * update_rate_ms); + ThisThread::sleep_for(update_rate_ms); if(imu.updateData()) { @@ -134,9 +136,7 @@ while (true) { - // note: for some reason it seems like wait() here waits 10x the time you tell it to - // not sure what's causing this behavior, and I don't see it with mbed os 2 - wait(.0001f * update_rate_ms); + ThisThread::sleep_for(update_rate_ms); if(imu.updateData()) { @@ -185,7 +185,7 @@ { // note: for some reason it seems like wait() here waits 10x the time you tell it to // not sure what's causing this behavior, and I don't see it with mbed os 2 - wait(.0001f * update_rate_ms); + ThisThread::sleep_for(update_rate_ms); if(imu.updateData()) { @@ -214,7 +214,7 @@ while (true) { - wait(.001f); + ThisThread::sleep_for(1); if(imu.updateData()) { @@ -275,9 +275,7 @@ while (true) { - // note: for some reason it seems like wait() here waits 10x the time you tell it to - // not sure what's causing this behavior, and I don't see it with mbed os 2 - wait(.0001f * update_rate_ms); + ThisThread::sleep_for(update_rate_ms); if(imu.updateData()) { @@ -345,9 +343,7 @@ while (true) { - // note: for some reason it seems like wait() here waits 10x the time you tell it to - // not sure what's causing this behavior, and I don't see it with mbed os 2 - wait(.0001f * update_rate_ms); + ThisThread::sleep_for(update_rate_ms); if(imu.updateData()) { @@ -388,7 +384,7 @@ while(!imu.begin()) { pc.printf("Failed to connect to IMU!\r\n"); - wait(.5); + ThisThread::sleep_for(500); } //Declare test harness