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.NumGuess

Description

Simple number guessing game on the OSEPP Keyboard shield.

Thanks to David Palmer for lending me his OSEPP shield to play with!

Synopsis

Documentation

osepp :: LCDController Source #

The OSepp LCD Shield is a 16x2 LCD using a Hitachi Controller Furthermore, it has backlight, and 5 buttons. The hook-up is quite straightforward, using our existing Hitachi44780 controller as an example. More information on this shield can be found at:

http://osepp.com/products/shield-arduino-compatible/16x2-lcd-display-keypad-shield/

data Key Source #

There are 5 keys on the OSepp shield.

initOSepp :: Arduino (LCD, Bool -> Arduino (), Arduino (Maybe Key)) Source #

Initialize the shield. This is essentially simply registering the lcd with the HArduino library. In addition, we return two values to the user:

  • A function to control the back-light
  • A function to read (if any) key-pressed

numGuess :: LCD -> (Bool -> Arduino ()) -> Arduino (Maybe Key) -> Arduino () Source #

Number guessing game, as a simple LCD demo. User thinks of a number between 0 and 1000, and the Arduino guesses it.

guessGame :: IO () Source #

Entry to the classing number guessing game. Simply initialize the shield and call our game function.