/* Sweep
 by BARRAGAN <http://barraganstudio.com>
 This example code is in the public domain.

 modified 8 Nov 2013
 by Scott Fitzgerald
 http://www.arduino.cc/en/Tutorial/Sweep
*/

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position
int count;

void setup() {
  Serial.begin(9600);
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
//pos=180;



  if (pos < 180){
    pos ++;
    myservo.write(pos);
  }

  if(pos == 180){
    delay(4000);
  }

 // pos =0;

  Serial.println(pos);
 // delay(2000);
  myservo.write(0);


     
}