Can I modify this Arduino program to make the servo stop and wait after the 180 degree turn?

I am trying to make a mechanical intervalometer using my Arduino and a Servo motor. I was wondering if anybody knows how to make a servo turn 180 degrees, wait several seconds, and turn 180 degrees in the opposite direction.
I have been trying to modify this program (http://www.arduino.cc/en/Tutorial/Sweep) but I have had no luck.

try this i use it to center my servos before mounting them

just copy and paste the whole thing into arduino ide

//connect black wire from servo to gnd
//connect red wire to +5v
//connect orange or signal to dp9
Servo myservo;
int pos = 90;

void setup() {


void loop() {

for(pos = 170; pos = 170; pos += 1)//change the 170 to whatever number you need

NachoMahma6 years ago
. Put a pause/wait/timer/whatever after each of the for loops.