Stability | experimental |
---|---|
Maintainer | erkokl@gmail.com |
Safe Haskell | None |
Computes the time a button is held pressed, demonstrating the use of
the pulseIn_hostOnly
function with a time-out.
Documentation
Computes the amount of time a push-button is connected to input pin 2 on the Arduino. We will wait for at most 5 seconds, as a further demonstration of the time-out facility. Note that the timing is done on the host side, so this measurement is inherently inaccurate.
The wiring is straightforward: Simply put a push-button between digital input 2 and +5V, guarded by a 10K resistor: