heptagon-arduino/prog.ept

25 lines
414 B
Text
Raw Normal View History

2020-12-14 20:22:04 +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<<4, 2, 13>>();
() = led<<3, 1, 9>>();
tel