Skip to content

Commit 6e7f7e6

Browse files
committed
Add to the pulseIn() header comment to use a pulldown or pullup resistor to keep from hanging.
1 parent 8aabac9 commit 6e7f7e6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cores/arduino/wiring_pulse.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@
3030
* before the start of the pulse. The pulseIn() function is not designed to detect
3131
* high frequencies. The consequences of using this function to detect frequencies
3232
* such as a 100KHz PWM signal could possibly cause a sketch to hang at the
33-
* pulseIn() function call.
33+
* pulseIn() function call. There is the chance a pin using pulseIn() could get
34+
* into a floating voltage state causing the hanging issue. This should be prevented
35+
* by using a pullup or pulldown resistor. pinMode(pin, INPUT_PULLUP) could also
36+
* be used to keep this from happening.
3437
*/
3538
extern uint32_t pulseIn( uint32_t ulPin, uint32_t ulState, uint32_t ulTimeout = 1000000UL ) ;
3639

0 commit comments

Comments
 (0)