Hi, I recently got a MPU-9250 and hooked it up to an Uno R3 board. When I read values from the accelerometer and gyroscope, the sensor seems to be working fine, however when I try to read values from the magnetometer, I am just getting a bunch of zeroes. This is my code, its pretty much identical to the code from the accelerometer so I'm not sure what I am doing wrong. When I output the value of status to the serial monitor, it gives me status error: -14.
/*
*/
#include "MPU9250.h"
#include <Wire.h>
MPU9250 IMU(Wire, 0x68);
int status;
void setup() {
Serial.begin(9600);
status = IMU.begin();
}
void loop() {
IMU.readSensor();
float magx = IMU.getMagX_uT();
float magy = IMU.getMagY_uT();
float magz = IMU.getMagZ_uT();
Serial.print(magx);
Serial.print(" ");
Serial.print(magy);
Serial.print(" ");
Serial.print(magz);
Serial.println("");
delay(1000);
}