simpler trouble with servo !

Hi, thanks for this forum !

I am French, sorry for my english :p I have a very simple problem with my servo Hitec HS422.... and I really don't understand it...

So i tried to send PWM by digital pin, with the use of digitalWrite and delayMicroseconds, on the yellow wire (there is red, black and yellow wires) On the datasheet, +PULSE WIDTH CONTROL 1500usec NEUTRAL And I've put 4 battery of 1.5v.

here is my program

int pwmPin = 3;

void setup(){ pinMode(pwmPin, OUTPUT); //Serial.begin(9600); }

void loop(){

digitalWrite(pwmPin, HIGH); delayMicroseconds(1500); digitalWrite(pwmPin, LOW); delayMicroseconds(18500);

}

I ve never seen a program as simpler as this... !

So my servo go on the left, out of range... is there a problem with the low ?! I am turning crazy, seriously... !! :-[

thanks for all,

Perhaps you should have used AnalogWrite() for PWM... This page should help: http://www.arduino.cc/en/Reference/AnalogWrite

analogWrite won't work. The servo signals are not actually PWM modulated, although they are sometimes referred to as that. They use Pulse Position Modulation and the code Siel posted above looks like it should work. I was wondering if the problem is with the wiring.

edit: I just tried the sketch in the first post and it works with my servo. Siel, how do you have the servo and batteries wired? Are all the grounds connected?

Thanks for your answer ! Yes, sorry for the mistake of PWM and PPM

It's really strange because I remember that one code did work ! but I didn't save it, and I remember also that I manipulated delay in ms, not in usec... I ve turn the servo with my hand, when he was not connected, may I injured it ?

However, I've just tried this : (I don't show void setup wich is the same)

void loop(){

digitalWrite(pwmPin, HIGH); }

and this :

void loop(){

digitalWrite(pwmPin, LOW); }

Always the same thing, the motor turn on the left, out of range...

thx again

EDIT : oups, the ground ?! heu... no :D I try

oh.... I am so sorry, this is really a noob mistake... ! So It work !!! Thanks A LOT ! yeaaah !!