Open
Description
As it stands, it's impossible to tell the meaning of the "timeout" parameter used in the pulseIn() function. The documentation states that pulseIn()
Returns the length of the pulse in microseconds or gives up and returns 0 if no complete pulse was received within the timeout.
but later describes the return value as
The length of the pulse (in microseconds) or 0 if no pulse started before the timeout.
The first statement implies that the timeout may occur any time after calling pulseIn(), even while the pulse is "ON" but hasn't yet turned "OFF". The second statement implies that the timeout may only occur before the pulse has started, so that it shouldn't time out once the pulse is "ON". Both cannot be true.