int servo = 0;
void setup() {
pinMode(servo, OUTPUT);
pinMode(led, OUTPUT);
}
void loop() {
// to turn anti-clockwise
for (int i = 0; i < 10; ++i) {
digitalWrite(servo, HIGH);
delayMicroseconds(800);
digitalWrite(servo, LOW);
delay(19);
}
delay(1000);
// turn clockwise
for (int i = 0; i < 10; ++i) {
digitalWrite(servo, HIGH);
delayMicroseconds(1500);
digitalWrite(servo, LOW);
delay(18);
}
delay(1000);
}