do {
digitalWrite(ServoPin,HIGH);
delayMicroseconds(1700);
digitalWrite(ServoPin,LOW);
delay(20);
if(millis() > 5000) {
break;
}
}
while(millis() <= 5000);
Isn't that redundant?
And also, that's a weird way of driving servos. With the servo library, you could just do something like,
Servo.write(150);
delay(5000);
Servo.write(90);
Obviously you can't just copy and paste this into arduino, but do you get what I mean?
Try looking up the servo library.