Toyomasa Watarai
/
Adafruit-BNO055-test
Adafruit BNO055 test code
Revision 2:a062f3e0b04f, committed 2021-03-16
- Comitter:
- MACRUM
- Date:
- Tue Mar 16 05:42:35 2021 +0000
- Parent:
- 1:6fbffee6db13
- Child:
- 3:eb3b5982a536
- Commit message:
- Mbed OS 6.x port
Changed in this revision
--- a/Adafruit_BNO055.lib Wed Sep 16 22:32:34 2015 +0000 +++ b/Adafruit_BNO055.lib Tue Mar 16 05:42:35 2021 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/Ben-Simon-Inez-IDD/code/Adafruit_BNO055/#8092160b6a59 +https://developer.mbed.org/teams/Ben-Simon-Inez-IDD/code/Adafruit_BNO055/#7db662f5d402
--- a/main.cpp Wed Sep 16 22:32:34 2015 +0000 +++ b/main.cpp Tue Mar 16 05:42:35 2021 +0000 @@ -6,7 +6,6 @@ /* Set the delay between fresh samples */ #define BNO055_SAMPLERATE_DELAY_MS (100) -Serial pc(USBTX, USBRX); I2C i2c(D7, D6); Adafruit_BNO055 bno = Adafruit_BNO055(-1, BNO055_ADDRESS_A, &i2c); @@ -19,27 +18,26 @@ /**************************************************************************/ int main() { - pc.baud(9600); - pc.printf("Orientation Sensor Raw Data Test\r\n"); + printf("Orientation Sensor Raw Data Test\r\n"); /* Initialise the sensor */ if(!bno.begin()) { /* There was a problem detecting the BNO055 ... check your connections */ - pc.printf("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!\r\n"); + printf("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!\r\n"); while(1); } else - pc.printf("BNO055 was detected!\r\n"); + printf("BNO055 was detected!\r\n"); - wait(1); + thread_sleep_for(1000); /* Display the current temperature */ int8_t temp = bno.getTemp(); - pc.printf("Current Temperature: %d C\r\n", temp); + printf("Current Temperature: %d C\r\n", temp); bno.setExtCrystalUse(true); - pc.printf("Calibration status values: 0=uncalibrated, 3=fully calibrated\r\n"); + printf("Calibration status values: 0=uncalibrated, 3=fully calibrated\r\n"); while(true) loop(); @@ -63,7 +61,7 @@ imu::Vector<3> euler = bno.getVector(Adafruit_BNO055::VECTOR_EULER); /* Display the floating point data */ - pc.printf("X: %f Y: %f Z: %f\t\t", euler.x(), euler.y(), euler.z()); + printf("X: %f Y: %f Z: %f\t\t", euler.x(), euler.y(), euler.z()); /* // Quaternion data @@ -82,6 +80,6 @@ /* Display calibration status for each sensor. */ uint8_t system, gyro, accel, mag = 0; bno.getCalibration(&system, &gyro, &accel, &mag); - pc.printf("CALIBRATION: Sys=%d, Gyro=%d, Accel=%d, Mag=%d\r\n", (int)(system), (int)(gyro), (int)(accel), (int)(mag)); - wait_ms(BNO055_SAMPLERATE_DELAY_MS); + printf("CALIBRATION: Sys=%d, Gyro=%d, Accel=%d, Mag=%d\r\n", (int)(system), (int)(gyro), (int)(accel), (int)(mag)); + thread_sleep_for(BNO055_SAMPLERATE_DELAY_MS); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Tue Mar 16 05:42:35 2021 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#bfde5aa1e74802771eaeacfa74789f71677325cb
--- a/mbed.bld Wed Sep 16 22:32:34 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/ba1f97679dad \ No newline at end of file