Turning Target system?

ok, heres the plan. i have a servo, 2 potentiometers, 2 mini tactile buttons, and arduino duelmanove (i carnt spell;) what i want the code to do is rotate the servo 90, hold for an adjustable amount of time (potentiometer 1). then rotate back to beginning for another adjustible amount of time (potentiometer 2) i also want there to be a manual button press for both 0 and 90 servo.

also serial control wouldnt go amiss either.

im not that good at coding with the arduino, so i was wondering if someone would helpfully write the program for me?

ok, ive gven up trying to do my original plan. so far i got this code

#include <Servo.h> 
 
Servo myservo; 
 
void setup() 
{ 
  myservo.attach(9); 
} 
 
void loop() 
{ 
  myservo.write(120);              
  delay(6000);                           
  myservo.write(0);
  delay(6000);
}

but it dosent seem to work. i want it visible (120) for 6 seconds, then hidden (0) for another 6, or a random amount of time.
any help?

but it dosent seem to work

In what way doesn't it work?

it does the delay(6000) fine, but after the last servo.write the delay is only for a second, if that.

How long does the 120 degree traverse take? Have you tried some debug prints of "millis()"?

it takes around about half a second, i got the specs of my servo here

voltage: dc5v +/- 1v pwm input range: pulse cycle 20ms +/-2ms, positve pulse 1~2ms speed: 0.1s/60degrees tourque: >= 1.0kg/cm(vcc=5v) MAX corner >=150degrees operation tempreture = -20C ~ 75c weight 7.5g dimensions 22.8*11.5*20.8mm colour black

According to the spec, it should take about 0.2 sec.

Are you drawing too much current and resetting the processor with a brown-out?

You should always power servos from a separate supply.

What do your debug prints say?

debug prints?

it does take about 0.2 seconds, timed it just now

ill try to power it seperatly, if im correct, 3AA batteries should be better than directly to the 5v pin on an arduino?

seperate power supply (3AA in a holder) diddnt work. it moved to the max position, then held there. any help?