mirror of
https://gitlab.com/jusax23/mpu6050.git
synced 2024-11-22 22:56:35 +01:00
23 lines
419 B
Arduino
23 lines
419 B
Arduino
|
|
||
|
#include <MPU6050_tockn.h>
|
||
|
#include <Wire.h>
|
||
|
|
||
|
MPU6050 mpu6050(Wire);
|
||
|
|
||
|
void setup() {
|
||
|
Serial.begin(9600);
|
||
|
Wire.begin();
|
||
|
mpu6050.begin();
|
||
|
mpu6050.calcGyroOffsets(true);
|
||
|
}
|
||
|
|
||
|
void loop() {
|
||
|
mpu6050.update();
|
||
|
Serial.print("angleX : ");
|
||
|
Serial.print(mpu6050.getAngleX());
|
||
|
Serial.print("\tangleY : ");
|
||
|
Serial.print(mpu6050.getAngleY());
|
||
|
Serial.print("\tangleZ : ");
|
||
|
Serial.println(mpu6050.getAngleZ());
|
||
|
}
|