hArduino-0.2: Control your Arduino board from Haskell.

Stabilityexperimental
Maintainererkokl@gmail.com
Safe HaskellNone

System.Hardware.Arduino.Examples.Switch

Description

Reads the value of a push-button switch and displays it continuously

Synopsis

Documentation

switch :: IO ()Source

Read the value of a push-button switch (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 7 on when the switch is pressed.

The wiring diagram is fairly straightforward:

Switch: ~10K pull-down resistor, between pin 2 and GND Push-button NO-switch (normally open) between pin-2 and 5V

Led : ~10K pull-down resistor between pin-7 and led+ Led between GND and the resistor

Don't neglect the resistors to make sure you don't do a short-circuit!