#include <Servo.h>
Servo myservo;
int pos = 0;
int L1 = 12;
int L2 = 11;
void setup() {
myservo.attach(9);
pinMode(L1, OUTPUT);
pinMode(L2, OUTPUT);
Serial.begin(9600);
}
void loop() {
for(pos = 120; pos=0; pos+=1)
{
myservo.write(pos);
delay(10);
digitalWrite(L1, HIGH);
digitalWrite(L2, LOW);
}
for(pos = 0; pos=120; pos-=1)
{
myservo.write(pos);
delay(10);
digitalWrite(L1, LOW);
digitalWrite(L2, HIGH);
}
}