X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=Tasks%2FExamples.icl;h=4ca051dc16591587190d2ec3936111a51dd8125b;hb=0403d4e20b0d43efad9b17bb9f51d53559aad738;hp=94042747b4c57a608de6529d008369aca71315bd;hpb=639cdcf1c26177c87237bd5790e89184f531731d;p=mTask.git diff --git a/Tasks/Examples.icl b/Tasks/Examples.icl index 9404274..4ca051d 100644 --- a/Tasks/Examples.icl +++ b/Tasks/Examples.icl @@ -6,6 +6,23 @@ import mTask import Devices.mTaskDevice import iTasks._Framework.Serialization +pinShare :: Main (ByteCode () Stmt) +pinShare = sds \p=True In {main = + d0 =. p :. noOp + } + +faculty :: Int -> Main (ByteCode () Stmt) +faculty i = sds \y=i In sds \x=1 In {main = + IF (y <=. lit 1) ( + pub x :. retrn + ) ( + x =. x *. y :. + y =. y -. lit 1 + )} + +count :: Main (ByteCode () Stmt) +count = sds \x=0 In {main = x =. x +. lit 1 :. pub x :. noOp} + countAndLed :: Main (ByteCode () Stmt) countAndLed = sds \x=1 In sds \pinnetje=1 In {main = IF (digitalRead D3) ( @@ -47,7 +64,7 @@ ledtOff :: UserLED -> Main (ByteCode () Stmt) ledtOff d = {main = ledOff (lit d) :. noOp} readDPin :: DigitalPin -> Main (ByteCode () Stmt) -readDPin d = sds \pin=False In {main=pin =. digitalRead d :. noOp} +readDPin d = sds \pin=False In {main=pin =. digitalRead d :. pub pin :. noOp} ledSelection :: Task UserLED ledSelection = enterInformation "Select LED" [] @@ -63,4 +80,7 @@ allmTasks = 'DM'.fromList ,("readDPin", pinSelection @ readDPin) ,("blink", ledSelection @ blink) ,("blinkShare", treturn blinkShare) + ,("count", treturn count) + ,("faculty", enterInformation "Faculty" [] @ faculty) + ,("pinShare", treturn pinShare) ]