Reference.PulseIn History

Show minor edits - Show changes to markup

August 29, 2009, at 12:35 PM by David A. Mellis -
Changed lines 16-17 from:

value: type type of pulse to read: either HIGH or LOW. (int)

to:

value: type of pulse to read: either HIGH or LOW. (int)

November 02, 2008, at 10:58 AM by David A. Mellis -
Changed line 9 from:

pulseIn(pin, value)

to:

pulseIn(pin, value) \\

Deleted lines 39-41:

See also

November 02, 2008, at 10:57 AM by David A. Mellis -
Changed lines 1-3 from:

unsigned long pulseIn(pin, value)

unsigned long pulseIn(pin, value, timeout)

to:

pulseIn()

Changed lines 8-12 from:
to:

Syntax

pulseIn(pin, value) pulseIn(pin, value, timeout)

Changed lines 21-22 from:

the length of the pulse (in microseconds) or 0 if no pulse started before the timeout

to:

the length of the pulse (in microseconds) or 0 if no pulse started before the timeout (unsigned long)

March 29, 2008, at 04:09 PM by David A. Mellis -
Changed lines 2-3 from:
to:

unsigned long pulseIn(pin, value, timeout)

Changed lines 5-9 from:

Reads a pulse (either HIGH or LOW) on a pin. For example, if value is HIGH, pulseIn() waits for the pin to go HIGH, starts timing, then waits for the pin to go LOW and stops timing. Returns the length of the pulse in microseconds.

The timing of this function has been determined empirically and will probably show errors in longer pulses. Works on pulses from 10 microseconds to 3 minutes in length. Note that this function will not return until a pulse is detected.

to:

Reads a pulse (either HIGH or LOW) on a pin. For example, if value is HIGH, pulseIn() waits for the pin to go HIGH, starts timing, then waits for the pin to go LOW and stops timing. Returns the length of the pulse in microseconds. Gives up and returns 0 if no pulse starts within a specified time out.

The timing of this function has been determined empirically and will probably show errors in longer pulses. Works on pulses from 10 microseconds to 3 minutes in length.

Added lines 15-16:

timeout (optional): the number of microseconds to wait for the pulse to start; default is one second (unsigned long)

Changed lines 18-19 from:

the length of the pulse (in microseconds)

to:

the length of the pulse (in microseconds) or 0 if no pulse started before the timeout

Changed lines 39-41 from:
to:
September 27, 2007, at 05:10 AM by David A. Mellis - describing what the function does, not what it doesn't do.
Changed lines 6-8 from:

The timing of this function has been determined empirically and will probably show errors in longer pulses.Works on pulses from 10 microseconds to 3 minutes in length. Note that this function does not have a timeout built into it, so can appear to lock the Arduino if it misses the pulse.

to:

The timing of this function has been determined empirically and will probably show errors in longer pulses. Works on pulses from 10 microseconds to 3 minutes in length. Note that this function will not return until a pulse is detected.

April 18, 2007, at 02:20 PM by Paul Badger -
Added line 38:
April 18, 2007, at 02:20 PM by Paul Badger -
Deleted lines 37-38:
April 18, 2007, at 02:14 PM by Paul Badger -
Changed lines 6-8 from:

Works on pulses from 10 microseconds to 3 minutes in length.

to:

The timing of this function has been determined empirically and will probably show errors in longer pulses.Works on pulses from 10 microseconds to 3 minutes in length. Note that this function does not have a timeout built into it, so can appear to lock the Arduino if it misses the pulse.

April 18, 2007, at 02:07 PM by Paul Badger -
Added lines 6-8:

Works on pulses from 10 microseconds to 3 minutes in length.

April 14, 2006, at 02:56 PM by David A. Mellis - Documented pulseIn()
Added lines 1-36:

unsigned long pulseIn(pin, value)

Description

Reads a pulse (either HIGH or LOW) on a pin. For example, if value is HIGH, pulseIn() waits for the pin to go HIGH, starts timing, then waits for the pin to go LOW and stops timing. Returns the length of the pulse in microseconds.

Parameters

pin: the number of the pin on which you want to read the pulse. (int)

value: type type of pulse to read: either HIGH or LOW. (int)

Returns

the length of the pulse (in microseconds)

Example

 

int pin = 7;
unsigned long duration;

void setup()
{
  pinMode(pin, INPUT);
}

void loop()
{
  duration = pulseIn(pin, HIGH);
}

See also

Reference Home

Share