Hi,
I'm trying to interface a GY 521 MPU 6050 with an Arduino Uno using the code mentioned below
#include "Wire.h"
const int MPU=0x68;
int ax,ay,az,gx,gy,gz,temperature;
void setup() {
Serial.begin(115200);
Wire.begin();
Wire.beginTransmission(MPU);
Wire.write(0x6B);
Wire.write(0);
Wire.endTransmission(true);
}
void loop() {
Wire.beginTransmission(MPU);
Wire.write(0x3B);
Wire.endTransmission(false);
Wire.requestFrom(MPU,14,true);
ax = Wire.read()<<8|Wire.read(); //0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)
ay = Wire.read()<<8|Wire.read(); //0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)
az = Wire.read()<<8|Wire.read(); //0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)
temperature = Wire.read()<<8|Wire.read(); //0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L)
gx = Wire.read()<<8|Wire.read(); //0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)
gy = Wire.read()<<8|Wire.read(); //0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L)
gz = Wire.read()<<8|Wire.read(); //0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L)
Serial.print("ax/ay/az/gx/gy/gz/temperature\t");
Serial.print(ax);
Serial.print("\t");
Serial.print(ay);
Serial.print("\t");
Serial.print(az);
Serial.print("\t");
Serial.print(gx);
Serial.print("\t");
Serial.print(gy);
Serial.print("\t");
Serial.print(gz);
Serial.print("\t");
Serial.print(temperature/340 + 36.53);
Serial.println();
delay(100);
}
I tried to access the values on the Arduino create monitor and got a garbled output ( image attached)
As far as I can understand there is no way to decode this into meaningful values.
When I don't get garbled values I get a constant values of -1 for X,Y and Z, no matter how I move my gyroscope.
Please help me solve these issues and thanks a lot in advance.

