Skip to content

Commit 458e82f

Browse files
russmcinnissandeepmistry
authored andcommitted
add comment to pulseIn() in the header file to warn programmer about trying to detect high frequencies.
1 parent aaaf3db commit 458e82f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cores/arduino/wiring_pulse.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
* \brief Measures the length (in microseconds) of a pulse on the pin; state is HIGH
2828
* or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds
2929
* to 5 minutes in length, but must be called at least a few dozen microseconds
30-
* before the start of the pulse.
30+
* before the start of the pulse. The pulseIn() function is not designed to detect
31+
* high frequencies. The consequences of using this function to detect frequencies
32+
* such as a 100KHz PWM signal could possibly cause a sketch to hang at the
33+
* pulseIn() function call.
3134
*/
3235
extern uint32_t pulseIn( uint32_t ulPin, uint32_t ulState, uint32_t ulTimeout = 1000000UL ) ;
3336

0 commit comments

Comments
 (0)