heptagon-arduino/lcd_hept/prog.ept

39 lines
759 B
Text
Raw Normal View History

2020-12-14 20:22:04 +01:00
open Arduinolib
node lcd_blink_msg (period, ledMax : int; msg : string; line: int ) returns ()
2020-12-27 12:40:42 +01:00
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);
2021-01-03 15:00:26 +01:00
() = 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 ()
2021-01-03 15:00:26 +01:00
var j : int;
start : bool;
2021-01-03 15:00:26 +01:00
let
j = 0 fby (j+1);
start = j < 1;
2021-01-03 15:00:26 +01:00
() = lcd_init() when start;
() = 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