-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Control your Arduino board from Haskell.
--
-- Control Arduino from Haskell, using the Firmata protocol.
--
-- The hArduino library allows construction of Haskell programs that
-- control Arduino boards that are running the (freely available) Firmata
-- program. Note that hArduino does not allow you to run arbitrary
-- Haskell code on the Arduino! It simply allows you to control a board
-- from Haskell, where you can exchange information with the board,
-- send/receive commands from other peripherals connected, etc.
--
-- hArduino is work-in-progress. Comments, bug-reports, and patches are
-- welcome.
@package hArduino
@version 0.2
-- | (The hArduino library is hosted at
-- http://leventerkok.github.com/hArduino/. Comments, bug reports,
-- and patches are always welcome.)
--
-- hArduino: Control Arduino from Haskell, using the Firmata protocol.
--
-- The hArduino library allows construction of Haskell programs that
-- control Arduino boards that are running the (freely available) Firmata
-- program. Note that hArduino does not allow you to run arbitrary
-- Haskell code on the Arduino! It simply allows you to control a board
-- from Haskell, where you can exchange information with the board,
-- send/receive commands from other peripherals connected, etc.
module System.Hardware.Arduino
-- | Run the Haskell program to control the board:
--
--
-- - The file path argument should point to the device file that is
-- associated with the board. (COM1 on Windows,
-- '/dev/cu.usbmodemfd131' on Mac, etc.)
-- - The boolean argument controls verbosity. It should remain
-- False unless you have communication issues. The print-out is
-- typically less-than-useful, but it might point to the root cause of
-- the problem.
--
--
-- See System.Hardware.Arduino.Examples.Blink for a simple
-- example.
withArduino :: Bool -> FilePath -> Arduino () -> IO ()
-- | The Arduino monad.
data Arduino a
-- | Retrieve the Firmata firmware version running on the Arduino. The
-- first component is the major, second is the minor. The final value is
-- a human readable identifier for the particular board.
queryFirmware :: Arduino (Word8, Word8, String)
-- | Set the mode on a particular pin on the board
setPinMode :: Pin -> PinMode -> Arduino ()
-- | Read the value of a pin in digital mode; this is a non-blocking call,
-- returning the current value immediately. See waitFor for a
-- version that waits for a change in the pin first.
digitalRead :: Pin -> Arduino Bool
-- | Set or clear a digital pin on the board
digitalWrite :: Pin -> Bool -> Arduino ()
-- | Wait for a change in the value of the digital input pin. Returns the
-- new value. Note that this is a blocking call. For a non-blocking
-- version, see digitalRead, which returns the current value of a
-- pin immediately.
waitFor :: Pin -> Arduino Bool
-- | Delay the computaton for a given number of milli-seconds
delay :: Int -> Arduino ()
-- | Declare a pin on the board by its number.
pin :: Word8 -> Pin
-- | The mode for a pin.
data PinMode
-- | Digital input
INPUT :: PinMode
-- | Digital output
OUTPUT :: PinMode
-- | Analog input
ANALOG :: PinMode
-- | PWM (Pulse-Width-Modulation) output
PWM :: PinMode
-- | Servo Motor controller
SERVO :: PinMode
-- | Shift controller
SHIFT :: PinMode
-- | I2C (Inter-Integrated-Circuit) connection
I2C :: PinMode
-- | The hello world of the arduino world, blinking the led.
module System.Hardware.Arduino.Examples.Blink
-- | Blink the led connected to port 13 on the Arduino UNO board. The
-- blinking will synchronize with the printing of a dot on stdout.
--
-- Depending on your set-up, you will need to change the path to the USB
-- board. If you have problems, try changing the first argument to
-- True in the call to withArduino, which will hopefully
-- print a useful diagnostic message.
blink :: IO ()
-- | Reads the value of a push-button switch and displays it continuously
module System.Hardware.Arduino.Examples.Switch
-- | 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!
switch :: IO ()