MPU-6050 Basic

#include<Wire.h>

const int MPU=0x68;

int16_t GyX, GyY, GyZ;

void readGyro() {
  Wire.beginTransmission(MPU);
  Wire.write(0x43);  // Register 67, Gyroscope measurement
  Wire.endTransmission(false);
  Wire.requestFrom(MPU,6,true);

  GyX = (Wire.read()<<8|Wire.read());
  GyY = (Wire.read()<<8|Wire.read());
  GyZ = (Wire.read()<<8|Wire.read());
}

void setup(){
  Wire.begin();
  Wire.beginTransmission(MPU);
  Wire.write(0x6B); // Register 107, Power Management
  Wire.write(0);    // Disable sleep
  Wire.endTransmission(true);  // Release bus after transmission
  Serial.begin(9600);

  delay(1000);
}

void loop(){
  readGyro();

  Serial.print("Gyroscope: ");
  Serial.print("X = ");
  Serial.print(GyX);
  Serial.print(" | Y = ");
  Serial.print(GyY);
  Serial.print(" | Z = ");
  Serial.println(GyZ);

  delay(500);
}