#include <Servo.h>          
Servo myservo;              
int ServoPos;

void setup() {
  Serial.begin(9600);
  
  myservo.attach(9);

  myservo.write(0);
      Serial.println("0");
    delay(1500);
  myservo.write(40);
    Serial.println("40");
    delay(1500);
  myservo.write(100);
    Serial.println("100");
    delay(1500);
}

void loop() {
  for(ServoPos=20;  ServoPos <= 125 ; ServoPos+= 5){
    myservo.write(ServoPos);
    delay(100);
    Serial.println(ServoPos);
  }

  for(ServoPos=140; ServoPos>=0; ServoPos -=2){
    myservo.write(ServoPos);
    delay(100);
    Serial.println(ServoPos);
  }

  myservo.write(60);
    Serial.println("60");
    delay(1000);

  myservo.write(120);
    Serial.println("120");
    delay(1000);  

}