#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() {
// put your main code here, to run repeatedly:
sensors_event_t acc,gcc,temp;
m_p_u.getEvent(&acc,&gcc,&temp);
Serial.println("Acceleration on x axes ");
Serial.println(acc.acceleration.x);
delay(1000); // this speeds up the simulation
Serial.println("rotation of x axis ");
Serial.println((gcc.gyro.x)*180/3.14);
delay(1000); // this speeds up the simulation
}