From 6e7f7e6040cdf12b5dc73b6b3e0830e6471591f9 Mon Sep 17 00:00:00 2001 From: russmcinnis Date: Wed, 3 May 2017 11:37:27 -0700 Subject: [PATCH] Add to the pulseIn() header comment to use a pulldown or pullup resistor to keep from hanging. --- cores/arduino/wiring_pulse.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cores/arduino/wiring_pulse.h b/cores/arduino/wiring_pulse.h index 4af69e02..9e14ed1c 100644 --- a/cores/arduino/wiring_pulse.h +++ b/cores/arduino/wiring_pulse.h @@ -30,7 +30,10 @@ * before the start of the pulse. The pulseIn() function is not designed to detect * high frequencies. The consequences of using this function to detect frequencies * such as a 100KHz PWM signal could possibly cause a sketch to hang at the - * pulseIn() function call. + * pulseIn() function call. There is the chance a pin using pulseIn() could get + * into a floating voltage state causing the hanging issue. This should be prevented + * by using a pullup or pulldown resistor. pinMode(pin, INPUT_PULLUP) could also + * be used to keep this from happening. */ extern uint32_t pulseIn( uint32_t ulPin, uint32_t ulState, uint32_t ulTimeout = 1000000UL ) ;