I am trying to read data from the MPU 9250, but I have problems with finding the right library. I have tried lots of them, but none of them worked fine. I tried the SparkFun lib, it worked for a couple of seconds, then values were 0. And I didn't even get the mag data. That is my biggest issue! I haven't found any lib which prints the Magnetometer Values.... I really don't know why...
Has anyone a MPU9250 and ESP32 which works fine? If so, which libraries are used, and are there any little changes in them?
First of all, thx for your answer.
My Cricuit is like that (I don't know yet, whether 5V or 3.3V is better)
5V/3.3V (I tried both) --------- VCC
GND ---------------------------GND
21------------------------------SDA
22------------------------------SCL
I tried the Asukiaaa lib, I get something like this:
C:\Users\fkhue\Documents\Arduino\libraries\ESP32-Arduino-MPU9250-master\I2Cbus.cpp: In member function 'esp_err_t i2cbus::I2C::readBytes(uint8_t, uint8_t, size_t, uint8_t*, int32_t)':
C:\Users\fkhue\Documents\Arduino\libraries\ESP32-Arduino-MPU9250-master\I2Cbus.cpp:189:40: error: 'I2C_MASTER_LAST_NACK' was not declared in this scope
first of all, i don't have an MPU9250, but I do have an ADXL355.
I programmed it on an Arduino UNO, which basically is C++, and I'm using I2C to communicate.
I've made a repository on GitHub, you can find it here.
I only displayed the acceleration data, but it should work the same when reading the addresses of the Mag data.
Maybe you can use some inspiration from this repository.
The problem that I encountered was somewhat the same as yours:
it worked for a couple of seconds, then values were 0
I came to the conclusion that something was wrong with the address, so i used an I2C-Scanner to see which address I was using for the ADXL355. There were two of them:
Address 0x53, this address is shown when the SDA pin was pulled HIGH.
Address 0x1D, this address is shown when the SDA pin was pulled to GND.