Toyomasa Watarai
/
Adafruit-BNO055-test
Adafruit BNO055 test code
Diff: main.cpp
- Revision:
- 2:a062f3e0b04f
- Parent:
- 1:6fbffee6db13
--- 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); }