Arduino - DelayMicroseconds

Arduino

Guide

Tutorials

Reference

Hardware

Software

Forum

Playground

Exhibition

Hacking

FAQ

Buy

Language | Libraries | Comparison

## 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

#### 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.

#### Warning

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.

#### See also

- millis
- delay

Reference Home

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

Edit Page | Page History | Printable View | Recent Site Changes