2020-12-14 20:22:04 +01:00
|
|
|
open Arduinolib
|
|
|
|
|
2021-01-05 00:10:53 +01:00
|
|
|
node lcd_blink_msg (period, ledMax : int; msg : string; line: int ) returns ()
|
2020-12-27 12:40:42 +01:00
|
|
|
var i : int;
|
2021-01-03 14:39:38 +01:00
|
|
|
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);
|
2021-01-03 15:00:26 +01:00
|
|
|
() = lcd_string((" ", line) when downt);
|
2021-01-03 14:39:38 +01:00
|
|
|
tel
|
|
|
|
|
2021-01-05 00:10:53 +01:00
|
|
|
node lcd_counter (period:int; line: int) returns ()
|
|
|
|
var count : int;
|
|
|
|
let
|
|
|
|
count = 0 fby (count + 1);
|
|
|
|
() = lcd_int(count/period, line);
|
|
|
|
tel
|
|
|
|
|
2021-01-03 14:39:38 +01:00
|
|
|
node main() returns ()
|
2021-01-03 15:00:26 +01:00
|
|
|
var j : int;
|
2021-01-05 00:10:53 +01:00
|
|
|
start : bool;
|
2021-01-03 15:00:26 +01:00
|
|
|
let
|
|
|
|
j = 0 fby (j+1);
|
2021-01-05 00:10:53 +01:00
|
|
|
start = j < 1;
|
2021-01-03 15:00:26 +01:00
|
|
|
() = lcd_init() when start;
|
2021-01-05 00:10:53 +01:00
|
|
|
|
|
|
|
() = lcd_blink_msg ((2, 1, "hello world!", 0) when not start);
|
|
|
|
() = lcd_counter ((1, 1) when not start);
|
|
|
|
|
2020-12-14 20:22:04 +01:00
|
|
|
tel
|
|
|
|
|