|Copyright||(c) Levent Erkok|
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: