Reference.DelayMicroseconds History

Show minor edits - Show changes to markup

April 02, 2010, at 05:25 AM by David A. Mellis -
Added lines 8-10:

Syntax

delayMicroseconds(us)

February 01, 2010, at 07:30 PM by David A. Mellis -
Changed lines 37-40 from:

To ensure more accurate delays, this functions disables interrupts during its operation, meaning that some things (like receiving serial data, or incrementing the value returned by millis()) will not happen during the delay. Thus, you should only use this function for short delays, and use delay() for longer ones.

delayMicroseconds(0) will generate a much longer delay than expected (~1020 us) as will using negative numbers as a parameter.

to:

As of Arduino 0018, delayMicroseconds() no longer disables interrupts.

August 15, 2009, at 03:03 PM by David A. Mellis -
Changed lines 1-2 from:

delayMicroseconds(us)

to:

delayMicroseconds()

Changed lines 9-11 from:

us: the number of microseconds to pause.

to:

us: the number of microseconds to pause (unsigned int)

February 21, 2009, at 10:30 PM by David A. Mellis -
Changed lines 4-7 from:

Pauses the program for the amount of time (in microseconds) specified as parameter. For delays longer than a few thousand microseconds, you should use delay() instead.

Currently, the largest value that will produce an accurate delay is 16383. This could change in future Arduino releases.

to:

Pauses the program for the amount of time (in microseconds) specified as parameter. There are a thousand microseconds in a millisecond, and a million microseconds in a second.

Currently, the largest value that will produce an accurate delay is 16383. This could change in future Arduino releases. For delays longer than a few thousand microseconds, you should use delay() instead.

Changed lines 9-11 from:

us: the number of microseconds to pause. (There are a thousand microseconds in a millisecond, and a million microseconds in a second.)

to:

us: the number of microseconds to pause.

February 08, 2009, at 01:32 PM by David A. Mellis -
Changed lines 43-44 from:
to:
September 25, 2008, at 11:43 PM by Paul Badger -
Changed lines 40-41 from:

delayMicroseconds(0) will generate a much longer delay than expected (~1020 us) as will negative numbers.

to:

delayMicroseconds(0) will generate a much longer delay than expected (~1020 us) as will using negative numbers as a parameter.

January 18, 2008, at 06:30 AM by Paul Badger -
Changed lines 4-5 from:

Pauses your program for the amount of time (in microseconds) specified as parameter. For delays longer than a few thousand microseconds, you should use delay() instead.

to:

Pauses the program for the amount of time (in microseconds) specified as parameter. For delays longer than a few thousand microseconds, you should use delay() instead.

October 16, 2007, at 05:00 PM by David A. Mellis - the reference is not a place for coordinating development
Changed lines 40-43 from:

Users should use care when using a variable as the parameter for delayMicroseconds. delayMicroseconds(0) will generate a much longer delay than expected (~1020 us) as will negative numbers, if passed as a parameters to delayMicroseconds.

Users desiring to patch delayMicroseconds(0) to work correctly (return immediately) should see this forum thread.

to:

delayMicroseconds(0) will generate a much longer delay than expected (~1020 us) as will negative numbers.

October 13, 2007, at 06:04 AM by Paul Badger -
Changed lines 40-41 from:

Users should use care when using a variable as the parameter of delayMicroseconds. delayMicroseconds(0) will generate a much longer delay than expected ~1020 us as will negative numbers, if passed as a parameters to delayMicroseconds.

to:

Users should use care when using a variable as the parameter for delayMicroseconds. delayMicroseconds(0) will generate a much longer delay than expected (~1020 us) as will negative numbers, if passed as a parameters to delayMicroseconds.

October 13, 2007, at 06:02 AM by Paul Badger -
Changed lines 42-43 from:

Users desiring to patch delayMicroseconds(0) to work correctly (return immediately) should see this forum thread.

to:

Users desiring to patch delayMicroseconds(0) to work correctly (return immediately) should see this forum thread.

October 13, 2007, at 06:00 AM by Paul Badger -
Changed line 35 from:

Warning

to:

Caveats and Known Issues

Added lines 40-43:

Users should use care when using a variable as the parameter of delayMicroseconds. delayMicroseconds(0) will generate a much longer delay than expected ~1020 us as will negative numbers, if passed as a parameters to delayMicroseconds.

Users desiring to patch delayMicroseconds(0) to work correctly (return immediately) should see this forum thread.

August 30, 2007, at 04:50 AM by Paul Badger -
August 30, 2007, at 04:36 AM by Paul Badger -
Changed lines 6-7 from:
to:

Currently, the largest value that will produce an accurate delay is 16383. This could change in future Arduino releases.

August 27, 2007, at 06:12 PM by David A. Mellis - don't document exact maximum as it may change, instead recommend delay() for longer delays.
Changed lines 4-6 from:

Pauses your program for the amount of time (in microseconds) specified as parameter.

to:

Pauses your program for the amount of time (in microseconds) specified as parameter. For delays longer than a few thousand microseconds, you should use delay() instead.

Changed lines 8-10 from:

us: the number of microseconds to pause. (There are a thousand microseconds in a millisecond, and a million microseconds in a second.) The largest value that will result in an accurate delay is 16383.

to:

us: the number of microseconds to pause. (There are a thousand microseconds in a millisecond, and a million microseconds in a second.)

August 27, 2007, at 03:30 PM by Paul Badger -
Changed lines 8-9 from:

us: the number of microseconds to pause. (there are a thousand microseconds in a millisecond, and a million microseconds in a second)

to:

us: the number of microseconds to pause. (There are a thousand microseconds in a millisecond, and a million microseconds in a second.) The largest value that will result in an accurate delay is 16383.

May 07, 2007, at 01:44 PM by Paul Badger -
Deleted lines 40-42:
September 17, 2006, at 12:08 PM by David A. Mellis -
Changed lines 34-35 from:

This function works very accurately in the range 10 microseconds and up. We cannot assure that delayMicroseconds will perform precisely for smaller delay-times.

to:

This function works very accurately in the range 3 microseconds and up. We cannot assure that delayMicroseconds will perform precisely for smaller delay-times.

To ensure more accurate delays, this functions disables interrupts during its operation, meaning that some things (like receiving serial data, or incrementing the value returned by millis()) will not happen during the delay. Thus, you should only use this function for short delays, and use delay() for longer ones.

January 13, 2006, at 12:47 AM by 82.186.237.10 -
Added lines 39-41:
December 29, 2005, at 03:02 PM by 82.186.237.10 -
Changed lines 1-12 from:

delayMicroseconds

What it does

It pauses your program for the amount of time (in microseconds) specified as parameter.

What parametres does it take

It takes one integer value as parameter. This value represents microseconds.

This function returns

nothing

to:

delayMicroseconds(us)

Description

Pauses your program for the amount of time (in microseconds) specified as parameter.

Parameters

us: the number of microseconds to pause. (there are a thousand microseconds in a millisecond, and a million microseconds in a second)

Returns

None

Changed line 33 from:

Note: Disclaimer

to:

Warning

Deleted line 35:
Changed lines 37-38 from:
to:
December 03, 2005, at 08:38 PM by 213.140.6.103 -
Added lines 1-40:

delayMicroseconds

What it does

It pauses your program for the amount of time (in microseconds) specified as parameter.

What parametres does it take

It takes one integer value as parameter. This value represents microseconds.

This function returns

nothing

Example

 
int outPin = 8;                 // digital pin 8

void setup()
{
  pinMode(outPin, OUTPUT);      // sets the digital pin as output
}

void loop()
{
  digitalWrite(outPin, HIGH);   // sets the pin on
  delayMicroseconds(50);        // pauses for 50 microseconds      
  digitalWrite(outPin, LOW);    // sets the pin off
  delayMicroseconds(50);        // pauses for 50 microseconds      
}

configures pin number 8 to work as an output pin. It sends a train of pulses with 100 microseconds period.

Note: Disclaimer

This function works very accurately in the range 10 microseconds and up. We cannot assure that delayMicroseconds will perform precisely for smaller delay-times.

See also

Share