I am using an Arduino Uno and learning to use the motion sensor. Currently I was not able to find the library which looks simple and would like to get your suggestion. I found this https://github.com/hideakitai/MPU9250 library to be simple but don't know how to use it.
For example, take this code:-
#include "MPU9250.h"
MPU9250 mpu;
void setup()
{
Serial.begin(115200);
Wire.begin();
delay(2000);
mpu.setup();
}
void loop()
{
static uint32_t prev_ms = millis();
if ((millis() - prev_ms) > 16)
{
mpu.update();
mpu.print();
Serial.print("roll (x-forward (north)) : ");
Serial.println(mpu.getRoll());
Serial.print("pitch (y-right (east)) : ");
Serial.println(mpu.getPitch());
Serial.print("yaw (z-down (down)) : ");
Serial.println(mpu.getYaw());
prev_ms = millis();
}
}
Some values are not defined here, like registration code and input pins. I am not used to reading the documentation code so might need help in that.