Reads a pulse (either
LOW) on a pin. For example, if
pulseIn() waits for the pin to go from
HIGH, starts timing, then waits for the pin to go
LOW and stops timing. Returns the length of the pulse in microseconds or gives up and returns 0 if no complete pulse was received within the timeout.
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.
|if the optional timeout is used code will execute faster.|
pulseIn(pin, value, timeout)
pin: the number of the Arduino pin on which you want to read the pulse. Allowed data types:
value: type of pulse to read: either HIGH or LOW. Allowed data types:
timeout (optional): the number of microseconds to wait for the pulse to start; default is one second. Allowed data types:
The length of the pulse (in microseconds) or 0 if no pulse started before the timeout. Data type: