Measures the length of a pulse in microseconds. This function starts measuring when the specified input value (HIGH or LOW) is read. If value is HIGH for example, pulseIn() waits for the pin to go HIGH, starts timing, then waits for the pin to go LOW and stops timing.
Parameters
pin - The GPIO pin number.
value - HIGH or LOW. The start input value to begin measuring.
timeout - In microseconds.
Returns
The length of the pulse in microseconds or 0 if no complete pulse was received within the given timeout.