PulseIn/developers

From Wiring

Jump to: navigation, search
This page is intended as a reference for core developers only, and the content is only changed after a consensus has been reached through discussion of any such changes. Please use the Discussion page to talk about any changes or issues you have with the current implementation.
pulseIn()
Classification Pulse input/output control methods
Suggested location WPulse.h
C++ required No
Timing constraints None
Version introduced 1.0 (0100)
Framework dependencies None
Prototype(s)
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout)
Required? Yes
Issues None


Contents

Description

The pulseIn() method returns the length in microseconds on a digital input pin for a short period of time from 10 milliseconds to 3 minutes.

Black Box Input

The pin number, the transition (between HIGH or LOW) and a timeout value (in microseconds) are provided.

Black Box Output

No output.

Overloading

None. Single signature only.

Notes

pulseIn() can be used to read sensors that return a pulse train like some accelerometers or rangers. The user can specify the counting on HIGH or LOW transitions. The pulseIn command stops all activity while executing. A timeout of 1 second (1000000 microseconds) prevents the command to wait forever. A specific timeout in microseconds can also be specified.

Proposed Changes

For Wiring 1.1

According to Issue 9, pinMode() will be defined as:

void pinMode(pin_t pin, uint8_t value);

See Issue 9 for more details.

Personal tools