"MPU6050 does not name a type" fix?

I tried to upload this code which is downloaded from youtube for my gy521, but it doesn’t work.
“MPU6050 does not name a type” shows up when I upload to the uno. What cause that problem?
Thanks guys :grinning:

#include <SoftI2CMaster.h>
#include "Wire.h"
#include "I2Cdev.h"
#include "MPU6050.h"
#include  <Servo.h>
 
MPU6050 mpu;
 
int16_t ax, ay, az;
int16_t gx, gy, gz;
 
Servo Xservo;
Servo Yservo;
 
int valX;
int prevValX;
int valY;
int prevValY;

void setup() 
{
    Wire.begin();
    Serial.begin(38400);
 
    Serial.println("Initialize MPU");
    mpu.initialize();
    Serial.println(mpu.testConnection() ? "Connected" : "Connection failed");
    Xservo.attach(9);
    Yservo.attach(10);
}
 
void loop() 
{
    mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
 
    valX = map(ax, 17000, -17000, 0, 179);
    if (valX != prevValX)
    {
        Xservo.write(valX);
        prevValX = valX;
    }
 
 valY = map(ay, -17000, 17000, 0, 179);
    if (valY != prevValY)
    {
        Yservo.write(valY);
        prevValY = valY;
    }
    delay(90);
}

This is what I used, Im just copy/pasting for you

    // MPU-6050 Short Example Sketch
    // By Arduino User JohnChi
    // August 17, 2014
    // Public Domain
    #include<Wire.h>
    const int MPU=0x68;  // I2C address of the MPU-6050
    int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
    void setup(){
      Wire.begin();
      Wire.beginTransmission(MPU);
      Wire.write(0x6B);  // PWR_MGMT_1 register
      Wire.write(0);     // set to zero (wakes up the MPU-6050)
      Wire.endTransmission(true);
      Serial.begin(115200);
    }
    void loop(){
      Wire.beginTransmission(MPU);
      Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)
      Wire.endTransmission(false);
      Wire.requestFrom(MPU,14,true);  // request a total of 14 registers
      AcX=Wire.read()<<8|Wire.read();  // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)    
      AcY=Wire.read()<<8|Wire.read();  // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)
      AcZ=Wire.read()<<8|Wire.read();  // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)
      Tmp=Wire.read()<<8|Wire.read();  // 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L)
      GyX=Wire.read()<<8|Wire.read();  // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)
      GyY=Wire.read()<<8|Wire.read();  // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L)
      GyZ=Wire.read()<<8|Wire.read();  // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L)
      /*Serial.print("AcX = "); Serial.print(AcX);
      Serial.print(" | AcY = "); Serial.print(AcY);
      Serial.print(" | AcZ = "); Serial.print(AcZ);
      Serial.print(" | Tmp = "); Serial.print((Tmp / 340. + 36.53) * 1.8 + 32);  //equation for temperature in degrees C from datasheet
      Serial.print(" | GyX = "); Serial.print(GyX);
      Serial.print(" | GyY = "); Serial.print(GyY);
      Serial.print(" | GyZ = "); Serial.println(GyZ);*/
      Serial.write(AcX >> 8);
      Serial.write(AcX & 255);
      Serial.write(AcY >> 8);
      Serial.write(AcY & 255);
      Serial.write(AcZ >> 8);
      Serial.write(AcZ & 255);
      delay(50);
    }

[\code]

Although, be careful, I think this codes swaps the Gyro output with the Accelerometer output, I dont remember if I corrected that or not

Where did you get, if in fact you did, the MPU6050.h? It is a non standard (as in not included in the IDE) library header file. Did the youtube video give a location for the library? If so, post a link to it here, and download and install it.