#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
unsigned long startMillis =0;
unsigned long currentMillis =0;
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
myservo.write(0);
Serial.begin(9600);
Serial.println(" Started : ");
}
void loop() {
int time = 60000/180;
currentMillis = millis(); //current time
if (currentMillis - startMillis >= time)
{
startMillis = currentMillis;
myservo.write(pos);
Serial.println(currentMillis);
pos++;
if(pos==180)
{
pos=0;
}
}
}