Pulsin hat einen optionalen dritten parameter: Timeout. Nach dieser Zeit bricht die Messung ab. Dies damit Pulsein das Programm in alle Ewigkeit blockiert falls kein Impuls kommt. Defauld-Wert ohne Angabe ist 1 Sekunde.
pulseIn(pin, value, timeout)
Parameters
pin: the number of the pin on which you want to read the pulse. (int)
value: type of pulse to read: either HIGH or LOW. (int)
timeout (optional): the number of microseconds to wait for the pulse to start; default is one second (unsigned long)
Grüße Uwe