getting gyro to turn servo

Hi
I'm currently building an automated camera following system for a school project.
I am having issues with getting the gyro to tern the servo ( i need the servo to turn the opposite way to gyro to make the camera stable) I have tried using an MPU6050 and a GY-61 looking at countless test codes and editing them to find a solution that will actually work but I can't find any.

this the part I'm having the issue with

X_axis.write(0);
Y_axis.write(0);
Y_axis.write(90);
if(ypin > 13 )
{
for(angle = 90; angle < 90; angle += 1)
{
Y_axis.write(angle);
delay(15);
}
}
else if (ypin <= 13)
{
for(angle = 90; angle > 90; angle -= 1)
{
Y_axis.write(angle);
delay(15);
}
}

Master.ino (2.73 KB)

Don't check yPin - it's 2. I expect you meant to use y instead.