pulseIn() \ Language (API) \ Wiring ALPHA 1.0
Author: Hernando Barragán
Description: Wiring is an electronic sketchbook and hardware electronics for developing ideas. It is a context for learning fundamentals of computer programming and prototyping with electronics within the context of the electronic arts.
Keywords: Wiring, Processing, Interactive Media, Electronic Arts, Programming, C, C++, Hernando Barragán

Search wiring.org.co:

Reference for Wiring version 0023+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Name | ### pulseIn()
Examples |
    int inpin = 0;
    int val = 0;

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

    void loop() {
      val = pulseIn(inpin, HIGH);
    }
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. It 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.
Syntax |
    pulseIn(pin,transition)
    pulseIn(pin,transition,timeout)
Parameters |
pin | int: the pin used for reading the pulse
transition | HIGH or LOW
timeout | int: a timeout value in microseconds
Returns | int
Usage | Application

Updated on November 01, 2009 11:52:55pm PST