Issues interfacing Arduino Uno with GY 521

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.

Screen Shot 2018-11-26 at 7.26.13 PM.png

Looks like wrong baud settings. I cannot see the setting on the screen picture. You should set it to the 115200 you've chosen in the sketch.

pylon:
Looks like wrong baud settings. I cannot see the setting on the screen picture. You should set it to the 115200 you've chosen in the sketch.

Hi, I did have the baud set to 115200. I tried it again right now just to make sure, and got the output I've added to my main post attachments.
I believe -1 would indicate a floating value; how can I fix that?

I believe -1 would indicate a floating value; how can I fix that?

No, that indicate a wiring problem. The sensor is not recognized. Post a wiring diagram (may be hand drawn)!

The MPU6050 is a 3V3 device, none of it's pins should be connected to 5V, neither directly nor by pull-up resistors!

pylon:
No, that indicate a wiring problem. The sensor is not recognized. Post a wiring diagram (may be hand drawn)!

The MPU6050 is a 3V3 device, none of it's pins should be connected to 5V, neither directly nor by pull-up resistors!

Hi, sorry for the extremely delayed reply. I played around with the wiring a bit and I'm getting values now. Thanks a long for your help.