#include<Servo.h>
Servo myservo;
int speed = 15;

void setup() {
  // put your setup code here, to run once:
  myservo.attach(5);
}

void loop() {
  // put your main code here, to run repeatedly:
for(int i =0; i<=180; i++)
{
  myservo.write(i);
  delay(speed);
  }
  for(int j =180; j>=0; j--)
  {
    myservo.write(j);
    delay(speed);
  }
}