-- 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.1
-- | (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.
digitalRead :: Pin -> Arduino (PinMode, Bool)
-- | Set or clear a particular digital pin on the board.
digitalWrite :: Pin -> Bool -> Arduino ()
-- | Delay the computaton for a given number of milli-seconds.
delay :: Int -> Arduino ()
-- | Smart constructor for a pin. The input should be between 1 and 13:
--
--
-- - Pins 0-1 are reserved for TX/RX; so can't be directly used.
-- - 13 pins is UNO specific, we will need to expand this definition if
-- we start supporting other boards.
--
pin :: Int -> Pin
-- | The mode for a pin.
data PinMode
INPUT :: PinMode
OUTPUT :: PinMode
ANALOG :: PinMode
PWM :: PinMode
SERVO :: 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 ()