Created
October 4, 2020 11:38
-
-
Save maxpromer/8c772bee9625e712ee1e83ca7610f085 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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