Error in my code help

One of the servos only has to move from 0 to 45 degrees everytime the other servo elevates. The other servo has to be in 3 positions which are different angles. First this servo is at 0 degrees, then at 5, the other servo moves from 0 to 45 degrees, lets the ball fall thorugh the bar and the ir sensors calcukate speed and acceleration. Then, the second servo goes back to 0 degrees, and the first servo goes back to 0 degrees. Then repeats the whole process with 10 degrees of inclination and then 15 degrees. I honestly think that with one time doing all this sequence would be ok.