#include #include #include #define MPU9250_ADDR 0x68 MPU9250_WE MPU9250 = MPU9250_WE(MPU9250_ADDR); float net_gravity_accel; void setup() { Serial.begin(115200); Wire.begin(); if (!MPU9250.init()) { Serial.println("MPU9520 is not responding"); } else { Serial.println("MPU9520 is connected"); } if (!MPU9250.initMagnetometer()) { Serial.println("Magnetometer is not responding"); } else { Serial.println("Magnetometer is connected"); } /*******************************************************************************************************/ /*MPU9250 General Settings*/ //MPU9250.autoOffsets(); // Lay the sensor on a level surface and call this function /* Sample rate divider divides the output rate of the gyroscope and accelerometer. * Sample rate = Internal sample rate / (1 + divider) * It can only be applied if the corresponding DLPF is enabled and 0= -1*margin && num <= margin) { return 0.0; } return num; }