#include <Servo.h>
Servo motor_1;
int pos; // the current position of the motor
int increment; // amount motor will move
int updateInterval = 100;// time between movements
unsigned long lastUpdate;
int MovePoint = 175; // the point that the motor will move to
void setup() {
motor_1.attach(3);
increment = 1; // changes amount motor will move per cycle
}
void loop() {
if((millis() - lastUpdate) > updateInterval && increment < MovePoint) // time to update
{
lastUpdate = millis();
pos += increment;
motor_1.write(pos);
Serial.println(pos);
}
}