Servo myServo;//creates servo object to play with
void setup(){
myServo.attach(2);//defines where the servo is attached
}
void loop(){//repeats that:
myServo.write(0);//turns the servo to its 0 positioon
delay(500);//waits 500 ms
myServo.write(180);//turns the servo 180 degrees
delay(500);//waits again
}
No comments:
Post a Comment