Generating a signal pulse for a few millisecons (RESOLVED)

What is the best way to make the arduino generate a signals pulse for a very accurate pulse duration? The pulse duration is on the order of 3 to 100 milliseconds.
Would a simple delay statement work? The pulse duration should be controlled as accurately as possible..

digitalWrite(pinNum, HIGH);
delay(xxx);
digitalWrite(pinNum,LOW);

mahela007:
What is the best way to make the arduino generate a signals pulse for a very accurate pulse duration? The pulse duration is on the order of 3 to 100 milliseconds.
Would a simple delay statement work? The pulse duration should be controlled as accurately as possible..

digitalWrite(pinNum, HIGH);

delay(xxx);
digitalWrite(pinNum,LOW);

That could work. "Very accurate" is not a numerical specification I can guess at or comment on, but if you have specific timing error specifications, perhaps we can comment. You also might consider using delayMicroseconds(us) where a us value of 3000 would give you a 3 millisecond delay with 4 usec resolution accuracy.

http://arduino.cc/en/Reference/DelayMicroseconds

Lefty

retrolefty:
but if you have specific timing error specifications, perhaps we can comment.
Lefty

um.. I'd say that, for my application, +/- 0.5 milliseconds would be acceptable.

Your original posting should work OK for that accuracy.

Lefty

OK.. thanks for the help.

Please take into account that the digitalWrite also take some time, so the delay(xxx) should be a tiny bit less...

Consider direct port manipulation to have faster low/high - Arduino Reference - Arduino Reference -

Ah.. that's what I was looking for. Thanks.

EDIT:
I read the link you provided, and I don't think I'll need that level of accuracy. The link claims to read/write in fractions of a microsecond ! The cons outweigh the pros in this instance..
Thanks for the suggestion though.

is this a one time pulse? or is it to be constantly emitted?
if the first, then id'e go with what has been said above...
if the second, id'e go with PWM (accurate enough for your project)

Yes.. it's a one time pulse.