I don't understand why you are doing this:
for (pos = 0; pos <= 180; pos += 1) { /* goes from 0 degrees to 180 degrees in steps of 1 degree */
if (pos > 0 && pos < 180) {
digitalWrite(LED1, HIGH);
} else {
digitalWrite(LED1, LOW);
}
myservo.write(pos);
delay(20);
}
instead of this:
digitalWrite(LED1, HIGH);
for (pos = 0; pos <= 180; pos += 1) { /* goes from 0 degrees to 180 degrees in steps of 1 degree */
myservo.write(pos);
delay(20);
}
digitalWrite(LED1, LOW);
There is no feedback from the servo so there is no way to know if it is broken unless you design some method (via hardware such as micro switch) to monitor whether it has moved or not.