heptagon-arduino/parallel_led/prog.ept

25 lines
414 B
Text
Raw Normal View History

2020-12-27 12:40:42 +01:00
open Arduinolib
node led<<period, ledMax : int; opin : 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;
() = dwrite((opin, true) when upt);
() = dwrite((opin, false) when downt);
tel
node main() returns ()
let
() = led<<3, 1, 13>>();
() = led<<4, 2, 9>>();
tel