hArduino-0.4: Control your Arduino board from Haskell.

Stabilityexperimental
Maintainererkokl@gmail.com
Safe HaskellNone

System.Hardware.Arduino.SamplePrograms.PulseIn

Description

Computes the time a button is held pressed, demonstrating the use of the pulseIn_hostOnly function with a time-out.

Synopsis

Documentation

pulseDemo :: IO ()Source

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: