MPU 6050 Gyroscopic Sensor
#include <Wire.h>
#include <MPU6050.h>
MPU6050 mpu;
void setup() {
Serial.begin(115200);
Wire.begin();
mpu.initialize();
if (mpu.testConnection()) {
Serial.println("MPU6050 Connected");
}
}
void loop() {
int16_t ax, ay, az;
int16_t gx, gy, gz;
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
Serial.print("AX: "); Serial.print(ax);
Serial.print(" AY: "); Serial.print(ay);
Serial.print(" AZ: "); Serial.print(az);
Serial.print(" GX: "); Serial.print(gx);
Serial.print(" GY: "); Serial.print(gy);
Serial.print(" GZ: "); Serial.println(gz);
delay(500);
}
Submit Your Review
Your email address will not be published. Required fields are marked *
Gadgets