You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
989 B
Plaintext
48 lines
989 B
Plaintext
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 lcd_button_counter (bpin, period, line : int) returns ()
|
|
var value : int;
|
|
count : int;
|
|
i : int;
|
|
let
|
|
i = 0 fby (i+1);
|
|
value = dread(bpin);
|
|
count = 0 fby (count + value);
|
|
() = lcd_int(count/period, line);
|
|
tel
|
|
|
|
node main() returns ()
|
|
var start : bool;
|
|
let
|
|
start = true fby false;
|
|
() = lcd_init() when start;
|
|
|
|
() = lcd_blink_msg ((750, 375, "hello world!", 0) when not start);
|
|
() = lcd_button_counter((8, 50, 1) when not start);
|
|
tel
|
|
|