Magnetometer Easy Calibration

Thanks for the answer.

 Vector norm = compass.readNormalize();

Here it takes the calibrated offset values.
I calculate the offsets I get with atan2 but I have no way of knowing how much the slope will be. There will be times when it is below 10 degrees, and times when it can be above. So I think I will need slope compensation.

void loop()
{

  Vector norm = compass.readNormalize();

  float heading = atan2(norm.YAxis, norm.XAxis);

  if (heading < 0)
  {
    heading += 2 * PI;
  }

  if (heading > 2 * PI)
  {
    heading -= 2 * PI;
  }

  float headingDegrees = heading * 180/M_PI; 

  Serial.print(" Heading = ");
  Serial.print(heading);
  Serial.print(" Degress = ");
  Serial.print(headingDegrees);
  Serial.println();

  delay(100);
}