I am discovering Arduino Nano 33 BLE and starting with the magnetometer. I am trying to understand in the readMagneticField function to get magnetic x, y & z datas from LSM9DS1 registers. And my first question is : why the function has this calculation ?
x = data * 4.0 * 100.0 / 32768.0;
extracted from this function : int LSM9DS1Class::readMagneticField in Arduino_LSM9DS1 library
in the function definition, x is supposed to be returned in uT (micro Tesla) and because 1 gauss = 100 uT, i think that it is normal to multiply by 100. On the multiply by 4.0, i suppose that it is because the defaut value in the CTRL_REG_M register refers to +/- 4 Gauss for the Full-scale selection, but I do not understand why we have to multiply by 4.0. ?
And i do not really understand why there is a division by 32768 ?