Arduino_LSM9DS1 - magneticFieldAvailable()

Query if new magnetic field data from the IMU is available.

Syntax

IMU.magneticFieldAvailable()

Parameters

None.

Returns

0 if no new magnetic field data is available, 1 if new magnetic field data is available.

Example

float x, y, z;

if (IMU.magneticFieldAvailable()) {
    IMU.readMagneticField(x, y, z);

    Serial.print(x);
    Serial.print('\t');
    Serial.print(y);
    Serial.print('\t');
    Serial.println(z);
}

See also