Help with some programming!!

But I have another problem:

My servo motor starts to rotate randomly when the programme starts, it only rotates as needed when the setcursor is set to 7.

What I want is for the servo motor to ONLY rotate when the setcursor is set to 7. SO how should I eliminate the random rotations?

I am not very sure it if is connection problem or programming problem.

Other info: my servo motor is connected to pin 9 of arduino and the other two wires are connected to ground and a 6V external source.