#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
Adafruit_MPU6050 m_p_u;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
while (!Serial)
delay(20);
if (!m_p_u.begin()) {
while (1) {
delay(20);
}
}
}
void loop() {
sensors_event_t acc, gcc, temp;
m_p_u.getEvent(&acc, &gcc, &temp);
Serial.print("AccX: ");
Serial.println(acc.acceleration.x);
Serial.print("AccY: ");
Serial.println(acc.acceleration.y);
Serial.print("AccZ: ");
Serial.println(acc.acceleration.z);
delay(10); // this speeds up the simulation
}