Data Sheet
Core Spartan Documentation Modern Robotics, Inc
Version 3.0.3 Page 42
void hardIronCalibration(void)
Hard Iron Calibration (HIC) is a method of checking for magnets or an object
generating a magnetic field around the sensor and generating an offset to
account for the magnetic field. During HIC the sensor must be rotated 360° in 5
seconds while keeping a constant pace. Try to start and stop the sensor pointing
due north. Refer to CalibrationHardIron example program for full calibration
details.
COMP.hardIronCalibration();
int getHeading(void)
This function returns the heading that ranges between 0 and 359. The heading is
calculated from the accelerometer readings, the magnetometer readings, and
the data collected during calibration.
int value;
value = COMP.getHeading();
…or…
Serial.print(COMP.getHeading());
void nullAccelometer(char axis)
This function will calibrate the X, Y and Z values by zeroing them. The X and Y
calibration must be done with the sensor laying flat on the horizon. The Z must
be calibrated with the sensor held vertical. Allow a minimum of 3 seconds for
calibration.
COMP.nullAccelerometer(X);
COMP.nullAccelerometer (Y);
COMP.nullAccelerometer (Z);
int getAccelerometer(char axis)
This function returns the accelerometer values for the X, Y and Z axis.
int value;
value = COMP.getAccelerometer ();
…or…
Serial.print(COMP.getAccelerometer ());










