Haskino Examples
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
blink
echo
firmware
hello-lawrence
lcd-counter
multi-led
night-light
parts
sem-example
state
test
.gitignore
README.md
stack.yaml

README.md

haskino-examples

This repository contains 9 example programs for use with the Haskino library.

The examples are as follows, with the name show being the stack build target name:

  • haskino-blink - Standard Arduino "Hello World", blinks the onboard LED.
  • haskino-hello - A Haskino "Hello World" for KU alumni everywhere for use with an LCD display.
  • haskino-echo - A Haskino Serial port echo program.
  • haskino-firmware - The shallow Haskino firmware interpreter, written in Haskino.
  • haskino-lcdcounter - A Haskino example with a OSEPP LCD shield with uses the LCD display and buttons to implement an up/down counter.
  • haskino-multiled - A Haskino example demonstrating the multi-tasking kernel with 3 LEDs.
  • haskino-night-light - A Haskino example that controls a night light and plays a song.
  • haskino-semexample - A Haskino example demonstrating the multi-tasking kernel and semaphore communication with a flashing LED.
  • haskino-state - A Haskino example demonstrating mutual recurion transformation implmenting a state machine using the OSEPP LCD shiel..

To build an example with shallow to deep translation (the default) (using haskino-blink as an example):

stack build haskino-blink

To build an example using the shallow DSL directly (using haskino-blink as an example):

stack build haskino-blink --flag haskino-blink:-deep

When moving between the shallow and deep versions, make sure and clean the example in between:

stack clean haskino-blink

To run the compiler in the resulting executable, make sure the compileProgram line is uncommented in the main function in the example, and the first line of main is commented.

To run the interpreter in the resulting executable, make sure the compileProgram line is commented in the main function in the example, and the first line of main is uncommented.

To execute the built example in the compiler or interpreter:

stack exec haskino-blink

To execute the built example in ghci (Object code flag required for shallow to deep translation):

stack ghci haskino-blink  --ghci-options -fobject-code

When building with the compiler, the result .ino C language file should be copied into the haskino/firmware/HaskinoRuntime directory, and the 'make upload' command used to program the Arduino board.

Note: The haskino-multiled and haskino-semexample programs use the multi-tasking portions of the Haskino runtime, and in running Haskino tasks on the Arduino, require the deep DSL, and will not work with the compiler or interpreter in the shallow version.

Also, the haskino-night-light deep flag default is reverse of the other examples, it defaults to building the shallow version.