Skip to content

Instantly share code, notes, and snippets.

@maxpromer
Created October 4, 2020 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxpromer/8c772bee9625e712ee1e83ca7610f085 to your computer and use it in GitHub Desktop.
Save maxpromer/8c772bee9625e712ee1e83ca7610f085 to your computer and use it in GitHub Desktop.
#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) > 100) {
mpu.update();
// mpu.print();
Serial.print("$");
//Serial.print("roll (x-forward (north)) : ");
Serial.print(mpu.getRoll());
Serial.print("\t");
//Serial.print("pitch (y-right (east)) : ");
Serial.print(mpu.getPitch());
Serial.print("\t");
//Serial.print("yaw (z-down (down)) : ");
Serial.print(mpu.getYaw());
Serial.print("\n");
prev_ms = millis();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment