Arduino Demo Code

Arduino Servo Control Code:

 

#include <Servo.h>

Servo myservo; 

int pos = 0;  

void setup()

{

  myservo.attach(9);

}

 void loop()

{

  for(pos = 5; pos <= 75

  ; pos += 1)

  {                                  

    myservo.write(pos);             

    delay(15);                      

  }

  delay(2000);

  for(pos = 75; pos>=5; pos-=1)    

  {                               

    myservo.write(pos);             

    delay(15);                      

  }

  delay(750);

}