Energia

## delayMicroseconds()

#### Description

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. For delays longer than a few thousand microseconds, you should use delay() instead.

#### Syntax

delayMicroseconds(us)

#### Parameters

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

#### Returns

None

#### Example

    int outPin = 14;                 // digital pin 14

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

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

configures pin 14 to work as an output pin. It sends a train of pulses with 32766 microseconds period.

#### Caveats and Known Issues

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

Currently, delayMicroseconds() no longer disables interrupts.

#### See also

- millis()
- micros()
- delay()

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Energia Reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Energia reference is based on Arduino reference. Code samples in the reference are released into the public domain.

©Energia | Edit Page | Page History | Printable View | All Recent Site Changes