1 Some example
\gls{mTask
}-
\glspl{Task
} --- using almost all of their
2 functionality --- are shown in Listing~
\ref{lst:exmtask
}. The
\CI{blink
}
3 \gls{mTask
} show the classic
\gls{Arduino
} blinking
\gls{LED
} application that
4 blinks a certain
\gls{LED
} every second. The
\CI{thermostat
} expression will
5 enable a digital pin powering a cooling fan when the analog pin representing a
6 temperature sensor is too high.
\CI{thermostat`
} shows the same expression but
7 now using the assignment style
\gls{GPIO
} technique. The
\CI{thermostat
}
8 example also shows that it is not necessary to run everything as a
\CI{task
}.
9 The main program code can also just consist of the contents of the root
10 \CI{main
} itself. Finally a thermostat example is shown that also displays the
11 temperature on its
\gls{LCD
} while regulating the temperature.
14 label=
{lst:exmtask
},caption=
{Some example
\gls{mTask
}-
\glspl{Task
}}]
18 blink = task
\blink.(
\x.
19 IF (x ==. lit True) (ledOn led) (ledOff led) :.
20 blink (lit
1000) (Not x)
21 In
{main=blink (lit
1000) True
}
23 thermostat =
{main = digitalWrite D0 (analogRead A0 >. lit
50)
}
25 thermostat` =
{main = d0 =. a0 > lit
50 }
27 thermostat`` = task
\th.(
\lcd.
30 th (lit
1000) lim ) In
31 LCD
16 12 [] \lcd.
{main = th (lit
1000) lim
}