sparkfun / SparkFun_LSM9DS1_Arduino_Library

Arduino library for the LSM9DS1 9DOF IMU.
Other
64 stars 78 forks source link

Calibration example #40

Open marcwitteveen opened 2 years ago

marcwitteveen commented 2 years ago

How do you use the calibration method? I call the method calibration but there is still offset and drift... anybody have a code example?

Palla551 commented 1 year ago

Hi, I guess is a llitle bit late but here's how I got the calibration to work

void setup() {
  Serial.begin(115200);

  Wire.begin(32, 33);

  imu.settings.device.commInterface = IMU_MODE_I2C;  // Set mode to I2C
  imu.settings.device.mAddress = LSM9DS1_M;          // Set mag address to 0x1E
  imu.settings.device.agAddress = LSM9DS1_AG;        // Set ag address to 0x6B

  if (imu.begin() == false) {
    Serial.println("Failed to communicate with LSM9DS1.");
    while (1)
      ;
  }

  imu.calibrate(true);

}