#include #include #include #include /* This driver reads raw data from the BNO055 Connections =========== Connect SCL to analog 5 Connect SDA to analog 4 Connect VDD to 3.3V DC Connect GROUND to common ground */ /* Set the delay between fresh samples */ #define BNO055_SAMPLERATE_DELAY_MS (100) Adafruit_BNO055 bno = Adafruit_BNO055(55); /**************************************************************************/ /* Arduino setup function (automatically called at startup) */ /**************************************************************************/ void setup(void) { Serial.begin(9600); Serial.println("Orientation Sensor Raw Data Test"); Serial.println(""); /* Initialise the sensor */ if(!bno.begin()) { /* There was a problem detecting the BNO055 ... check your connections */ Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!"); while(1); } delay(1000); /* Display the current temperature */ int8_t temp = bno.getTemp(); Serial.print("Current Temperature: "); Serial.print(temp); Serial.println(" C"); Serial.println(""); bno.setExtCrystalUse(true); Serial.println("Calibration status values: 0=uncalibrated, 3=fully calibrated"); } /**************************************************************************/ /* Arduino loop function, called once 'setup' is complete (your own code should go here) */ /**************************************************************************/ void loop(void) { /* Quaternion data */ imu::Quaternion quat = bno.getQuat(); Serial.print("qW: "); Serial.print(quat.w(), 4); Serial.print(" qX: "); Serial.print(quat.y(), 4); Serial.print(" qY: "); Serial.print(quat.x(), 4); Serial.print(" qZ: "); Serial.print(quat.z(), 4); Serial.print("\t\t"); /* Display calibration status for each sensor. */ uint8_t system, gyro, accel, mag = 0; bno.getCalibration(&system, &gyro, &accel, &mag); Serial.print("Sys="); Serial.print(system, DEC); Serial.print(" Gyro="); Serial.print(gyro, DEC); Serial.print(" Accel="); Serial.print(accel, DEC); Serial.print(" Mag="); Serial.println(mag, DEC); delay(1000); }