#include <Wire.h>
#include "I2Cdev.h"
#include "MPU6050.h"

// Create an instance of the MPU6050 sensor
MPU6050 mpu;

void setup() {
// Initialize the Serial communication
Serial.begin(115200);

// Initialize the I2C communication
Wire.begin();

// Initialize the MPU-6050 sensor
mpu.initialize();

// Check if the MPU-6050 is connected
if (mpu.testConnection()) {
Serial.println("MPU-6050 connection successful");
} else {
Serial.println("MPU-6050 connection failed");
}
}

void loop() {
int16_t ax, ay, az;
int16_t gx, gy, gz;

// Read accelerometer and gyroscope data from the MPU-6050
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);

// Send the gyroscope data in the expected format
Serial.print(gx);
Serial.print(",");
Serial.print(gy);
Serial.print(",");
Serial.println(gz);

// Wait for a short period before reading again
delay(60);
}