duration = pulseIn(7, HIGH, 25000);
if (duration[COLOR="Red"] > 1050[/COLOR]) { [COLOR="Red"]// <<<<<<<<<<<<[/COLOR]
mydelay = duration / 180;
for(pos = 60; pos < 120; pos += 1) // goes from 60 degrees to 120 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(mydelay); // waits for the servo to reach the position
}
for(pos = 120; pos>=60; pos-=1) // goes from 120 degrees to 60 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(mydelay); // waits for the servo to reach the position
}
[COLOR="red"]}[/COLOR] [COLOR="Red"]// <<<<<<<<<<<<[/COLOR]