24 lines
414 B
Text
24 lines
414 B
Text
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
|
|
|