Revision 3237e6e5

View differences:

examples/sensorapi/sensorapi.ino
25 25
   History
26 26
   =======
27 27
   2015/MAR/03  - First release (KTOWN)
28
   2015/AUG/27  - Added calibration and system status helpers
28 29
*/
29 30

  
30 31
/* Set the delay between fresh samples */
......
79 80

  
80 81
/**************************************************************************/
81 82
/*
83
    Display sensor calibration status
84
*/
85
/**************************************************************************/
86
void displayCalStatus(void)
87
{
88
  /* Get the four calibration values (0..3) */
89
  /* Any sensor data reporting 0 should be ignored, */
90
  /* 3 means 'fully calibrated" */
91
  uint8_t system, gyro, accel, mag;
92
  system = gyro = accel = mag = 0;
93
  bno.getCalibration(&system, &gyro, &accel, &mag);
94

  
95
  /* The data should be ignored until the system calibration is > 0 */
96
  Serial.print("\t");
97
  if (!system)
98
  {
99
    Serial.print("! ");
100
  }
101

  
102
  /* Display the individual values */
103
  Serial.print("Sys:");
104
  Serial.print(system, DEC);
105
  Serial.print(" G:");
106
  Serial.print(gyro, DEC);
107
  Serial.print(" A:");
108
  Serial.print(accel, DEC);
109
  Serial.print(" M:");
110
  Serial.println(mag, DEC);
111
}
112

  
113
/**************************************************************************/
114
/*
82 115
    Arduino setup function (automatically called at startup)
83 116
*/
84 117
/**************************************************************************/
......
125 158
  Serial.print(event.orientation.y, 4);
126 159
  Serial.print("\tZ: ");
127 160
  Serial.print(event.orientation.z, 4);
161

  
162
  /* Optional: Display calibration status */
163
  // displayCalStatus();
164

  
165
  /* New line for the next sample */
128 166
  Serial.println("");
129 167

  
168
  /* Wait the specified delay before requesting nex data */
130 169
  delay(BNO055_SAMPLERATE_DELAY_MS);
131 170
}

Also available in: Unified diff