Controlling Servo Motor Manually Using Arduino Uno

I am using a Futaba S3003 Servo Motor, trying to control it without using the library. So far, I have only been able to rotate it to 45 degrees. It does not sweep to 180 degrees as the pulse length of 2ms might suggest. What am I doing wrong? Here is my code to make it turn to 180 degrees and back to 0.

#define servoPin 3

void setup() {

pinMode(servoPin,OUTPUT);

}

Thanks for the help!

void loop()  {

digitalWrite(servoPin, HIGH);

delayMicroseconds(1000);

digitalWrite(servoPin, LOW);

delayMicroseconds(19000);

delay(500);

digitalWrite(servoPin, HIGH);

delayMicroseconds(2000);

digitalWrite(servoPin,LOW);

delayMicroseconds(18000);

delay(500);

}

Driving servos without using a library is a terrible waste of time and effort but....

Servos expect to see continuous repeating pulses. Sending a single pulse then nothing for half a second then another different length single pulse is not how they are driven.

Try sending a stream of pulses for as long as you want the servo in one position. Maybe just by using a for loop to repeat the sequence. Then you can swap to a stream with a different pulse length etc.

I hope you're not powering that big servo from the Arduino 5V pin because that might be another problem. It really needs a separate power supply. 4 x AA NiMH rechargeables would be good. Oh and the S3003 is only a 120 degree servo so don't expect to see a full 180 from it.

Steve

#include <Servo.h>

in other words use the Servo library. Its crazy to do anything else. However it does use timer1,
making pins 9 and 10 unavailable for analogWrite(), but there are some other libraries that use a
different timer if this is an issue.