hArduino-1.2: Control your Arduino board from Haskell.
Copyright(c) Levent Erkok
LicenseBSD3
Maintainererkokl@gmail.com
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.Hardware.Arduino.SamplePrograms.Button

Description

Reads the value of a push-button and displays it's status continuously on the computer screen and by lighting a led on the Arduino as long as the button is pressed.

Synopsis

Documentation

button :: IO () Source #

Read the value of a push-button (NO - normally open) connected to input pin 2 on the Arduino. We will continuously monitor and print the value as it changes. Also, we'll turn the led on pin 13 on when the switch is pressed.

The wiring is straightforward: Simply put a push-button between digital input 2 and +5V, guarded by a 10K resistor: