Arduino + Quadcopter + MPU6050

i currently doing a project of build a quadcopter using Arduino. It is hard to balance a quadcopter just by using PWM of the motor, so i install a MPU6050 sensor on it. However i have no idea on how to coding the MPU6050 to balance the quadcopter. Should i use PID library? Any sample source code?

Should i use PID library?

Of course.

Any sample source code?

For what?

Google IS your friend. There ARE sites dedicated to quadcopters. You are not the first to figure out that balancing one is non-trivial.

You can use this MPU-6000 Arduino code to start with your module. This would work for your module MPU-6050 as well.

It would give you the values of acceleration and rotation in the three axis and you can use this accordingly.