Arduino Function: NaxisMotion.readSystemCalibStatus


This function is used to return the magnetometer calibration status


uint8_t readMagCalibStatus(void)


 uint8_t: Magnetometer calibration status, 0-3 (0 - low, 3 – high)


//Contains the bridge code between the API and the Arduino Environment
#include "NAxisMotion.h"
#include <Wire.h>

//Object that for the sensor
NAxisMotion mySensor;

//To store the last streamed time stamp
unsigned long lastStreamTime = 0;

//To stream at 25Hz without using additional timers (time period(ms) =1000/frequency(Hz))
const int streamPeriod = 40;

//Flag to update the sensor data. Default is true to perform the first read before the first stream
bool updateSensorData = true;

void setup() { //This code is executed once
//Peripheral Initialization
//Initialize the Serial Port to view information on the Serial Monitor

//Initialize I2C communication to the let the library communicate with the sensor.
//The I2C Address can be changed here inside this function in the library

/* Sensor Initialization */
//Can be configured to other operation modes as desired

//The default is AUTO. Changing to manual requires calling the relevant update functions prior to calling the read functions

//Setting to MANUAL requires lesser reads to the sensor

void loop() { //This code is looped forever
if ((millis() - lastStreamTime) >= streamPeriod) {
lastStreamTime = millis();
mySensor.updateEuler(); //Update the Euler data into the structure of the object
mySensor.updateCalibStatus(); //Update the Calibration Status

Serial.print("Time: ");
Serial.print("ms ");

Serial.print(" H: ");
Serial.print(mySensor.readEulerHeading()); //Heading data
Serial.print("deg ");

Serial.print(" R: ");
Serial.print(mySensor.readEulerRoll()); //Roll data

Serial.print(" P: ");
Serial.print(mySensor.readEulerPitch()); //Pitch data
Serial.print("deg ");

Serial.print(" A: ");
Serial.print(mySensor.readAccelCalibStatus()); //Accelerometer Calibration Status (0 - 3)

Serial.print(" M: ");
Serial.print(mySensor.readMagCalibStatus()); //Magnetometer Calibration Status (0 - 3)

Serial.print(" G: ");
Serial.print(mySensor.readGyroCalibStatus()); //Gyroscope Calibration Status (0 - 3)

Serial.print(" S: ");
Serial.print(mySensor.readSystemCalibStatus()); //System Calibration Status (0 - 3)


Based on the reference originally written by Arduino Community, and