Servo Motor timed reaction

Is the code right?

I'm not being funny, but why don't you try it... then you'll know the answer. If it's not right, be it compile errors or "unexpected" behaviour, then you'll need to do some debugging. If it still gives problems, then ask specific questions here.