38 lines
759 B
Text
38 lines
759 B
Text
open Arduinolib
|
|
|
|
node lcd_blink_msg (period, ledMax : int; msg : string; line: int ) returns ()
|
|
var i : int;
|
|
ledTime : int;
|
|
upt : bool;
|
|
downt : bool;
|
|
|
|
let
|
|
i = 0 fby (i+1);
|
|
ledTime = i % period;
|
|
upt = ledTime < ledMax;
|
|
downt = not upt;
|
|
|
|
() = lcd_string((msg, line) when upt);
|
|
() = lcd_string((" ", line) when downt);
|
|
tel
|
|
|
|
node lcd_counter (period:int; line: int) returns ()
|
|
var count : int;
|
|
let
|
|
count = 0 fby (count + 1);
|
|
() = lcd_int(count/period, line);
|
|
tel
|
|
|
|
node main() returns ()
|
|
var j : int;
|
|
start : bool;
|
|
let
|
|
j = 0 fby (j+1);
|
|
start = j < 1;
|
|
() = lcd_init() when start;
|
|
|
|
() = lcd_blink_msg ((2, 1, "hello world!", 0) when not start);
|
|
() = lcd_counter ((1, 1) when not start);
|
|
|
|
tel
|
|
|