Hello! So I am having MPU9250 problems. When I try to initialize the sensor it returns an error. I checked my connections using a voltmeter on the ohm setting and there is a connection, just no data is going through to the main page. I have been stuck on this issue for a while, and I'm not sure what to do. I've tried new breadboards, different connectors, and putting the sensor in different spots on the breadboard. I downloaded it from the MPU9250 library I found. I know the sensor works because it has before with the same code, but for some reason, it doesn't work now. Here are the code and pictures.
Code:
#include "MPU9250.h"
// an MPU9250 object with the MPU-9250 sensor on SPI bus 0 and chip select pin 10
MPU9250 IMU(SPI,10);
int status;
void setup() {
// serial to display data
Serial.begin(115200);
while(!Serial) {}
// start communication with IMU
status = IMU.begin();
if (status < 0) {
Serial.println("IMU initialization unsuccessful");
Serial.println("Check IMU wiring or try cycling power");
Serial.print("Status: ");
Serial.println(status);
while(1) {}
}
}
void loop() {
// read the sensor
IMU.readSensor();
// display the data
Serial.print(IMU.getAccelX_mss(),6);
Serial.print("\t");
Serial.print(IMU.getAccelY_mss(),6);
Serial.print("\t");
Serial.print(IMU.getAccelZ_mss(),6);
Serial.print("\t");
Serial.print(IMU.getGyroX_rads(),6);
Serial.print("\t");
Serial.print(IMU.getGyroY_rads(),6);
Serial.print("\t");
Serial.print(IMU.getGyroZ_rads(),6);
Serial.print("\t");
Serial.print(IMU.getMagX_uT(),6);
Serial.print("\t");
Serial.print(IMU.getMagY_uT(),6);
Serial.print("\t");
Serial.print(IMU.getMagZ_uT(),6);
Serial.print("\t");
Serial.println(IMU.getTemperature_C(),6);
delay(100);
}
APDF.pdf (40.8 KB)
BPDF.pdf (22.1 KB)