i bought GY-521 IMU to balance my quadcopter.

Now i use value **angle_x** from gyro to control motors symmetric each other with PID algorithm.

i roll and cant blance, help me pls and thanks.

```
void loop()
{
esc1.write(u1);
esc2.write(u2);
esc3.write(u3);
esc4.write(u4);
delay(200);
if (Serial.available() > 0) {
cmd = Serial.read();
}
if (cmd == 'a')
{
// this value enough to make quadcopter lift off the ground
u1=46;
u2=110;
u3=115;
u4=113;
}
if (cmd == 'b')
{
//// stop motors
u1=0;
u2=0;
u3=0;
u4=0;
}
/////////////////////////////////// PID, balance quadcopter
unsigned long now = millis();
double timeChange = (double)(now - lastTime);
if(timeChange>=SampleTime)
{
errx= abs(0-angle_x);
err_del= errx - last_err;
if (angle_x < -9)
{
u1= u1 + Kp*errx + Kd*err_del;
u4= u4 + Kp*errx + Kd*err_del;
}
if (angle_x > 3)
{
u2= u2 + Kp*errx + Kd*err_del;
u3= u3 + Kp*errx + Kd*err_del;
}
last_err = errx;
//***********************************
delay(5);
}
}
```