fabianmoronzirfas
7/17/2014 - 5:31 PM

simple_timed_srvo_sketch.ino

#include <Servo.h>
int servopin = 9;
Servo myServo;
long previousMillis = 0;        // will store last time LED was updated
long interval = 30000;           // interval at which to blink (milliseconds)

void setup(){
  myServo.attach(servopin);

  
}

void loop(){
  unsigned long currentMillis = millis();

  if(currentMillis - previousMillis > interval) {
    // save the last time you blinked the LED 
    previousMillis = currentMillis;   
      myServo.write(25);
      delay(500);
      myServo.write(155);
      delay(500);
      
  }
}