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

System.Hardware.Arduino.SamplePrograms.Morse

Description

Morse code blinker. Original by Antoine R. Dumont, modified to simplify and fit into the existing examples structure.

Synopsis

Documentation

data Morse Source #

A dit or a dah is all we need for Morse: A dit is a dot; and a dah is a dash in the Morsian world. We use LBreak and WBreak to indicate a letter and a word break so we can insert some delay between letters and words as we transmit.

Constructors

Dit 
Dah 
LBreak 
WBreak 

Instances

Instances details
Show Morse Source # 
Instance details

Defined in System.Hardware.Arduino.SamplePrograms.Morse

Methods

showsPrec :: Int -> Morse -> ShowS #

show :: Morse -> String #

showList :: [Morse] -> ShowS #

dict :: [(Char, [Morse])] Source #

Morse code dictionary

decode :: String -> [Morse] Source #

Given a sentence, decode it. We simply drop any letters that we do not have a mapping for.

morsify :: [Morse] -> [Either Int Int] Source #

Given a morsified sentence, compute the delay times. A Left value means turn the led on that long, a Right value means turn it off that long.

transmit :: Pin -> String -> Arduino () Source #

Finally, turn a full sentence into a sequence of blink on/off codes

morseDemo :: IO () Source #

A simple demo driver. To run this example, you only need the Arduino connected to your computer, no other hardware is needed. We use the internal led on pin 13. Of course, you can attach a led to pin 13 as well, for artistic effect.