1 Some example
\gls{mTask
}-
\glspl{Task
} --- using almost all of their
2 functionality --- are shown in Listing~
\ref{lst:exmtask
}. The
3 \gls{mTask
}-
\glspl{Task
} shown in the example do not belong to a particular
4 view and therefore are of the type
\CI{View t r
}. The
\CI{blink
} \gls{mTask
}
5 show the classic
\gls{Arduino
} blinking
\gls{LED
} application that blinks a
6 certain
\gls{LED
} every second. The
\CI{thermostat
} expression will enable a
7 digital pin powering a cooling fan when the analog pin representing a
8 temperature sensor is too high.
\CI{thermostat`
} shows the same expression but
9 now using the assignment style
\gls{GPIO
} technique. The
\CI{thermostat
}
10 example also shows that it is not necessary to run everything as a
\CI{task
}.
11 The main program code can also just consist of the contents of the root
15 label=
{lst:exmtask
},caption=
{Some example
\gls{mTask
}-
\glspl{Task
}}]
16 blink = task
\blink=(
\x.
17 IF (x ==. lit True) (ledOn led) (ledOff led) :.
18 blink (lit
1000) (Not x)
19 In
{main=blink (lit
1000) True
}
21 thermostat :: Main (View () Stmt)
23 IF (analogRead A0 >. lit
50)
24 ( digitalWrite D0 (lit True) )
25 ( digitalWrite D0 (lit False) )
28 thermostat` :: Main (View () Stmt)
31 d0 = dIO D0 in
{main = IF (a0 >. lit
50) (d0 =. lit True) (d0 =. lit False)
}