-Start :: *World -> *World
-Start world = startEngine (mTaskManager
- >>* [OnAction (Action "Shutdown") (always $ shutDown)]) world
-
-mTaskMap :: Map String (Main (ByteCode () Stmt))
-mTaskMap = 'DM'.fromList [("count", bc), ("ledon", bc2 LED1), ("ledoff", bc3 LED3)]
-
-bc :: Main (ByteCode () Stmt)
-bc = sds \x=1 In sds \pinnetje=1 In {main =
- IF (digitalRead D3) (
- x =. x +. lit 1 :.
- pub x
- ) (
- noOp
- ) :.
- IF (pinnetje ==. lit 1) (
- ledOn LED1
- ) (
- IF (pinnetje ==. lit 2) (
- ledOn LED2
- ) (
- ledOn LED3
- )
- )}
-
-bc2 :: UserLED -> Main (ByteCode () Stmt)
-bc2 d = {main = ledOn d}
-
-bc3 :: UserLED -> Main (ByteCode () Stmt)
-bc3 d = {main = ledOff d}
+demo = viewSharedInformation "Devices" [] deviceStoreNP
+ >>* [OnValue $ ifValue pred (cont o hd)]
+ where
+ pred [] = False
+ pred [x:_] = not $ isEmpty x.deviceShares
+
+ cont :: MTaskDevice -> Task ()
+ cont dev
+ # rs = getRealShare dev (hd dev.deviceShares)
+ = get rs >>= \oldvalue->
+ forever (updateSharedInformation "Blinkyblink" [] (getRealShare dev (hd dev.deviceShares))
+ >>* [OnAction ActionContinue (const $ Just $ treturn ())])
+ -|| (wait "bigger than 10" (\x->x == oldvalue) rs
+ >>= viewInformation "Bigger:)" [])
+
+ toInt :: BCValue -> Int
+ toInt (BCValue e) = dynToInt (dynamic e)
+
+ dynToInt :: Dynamic -> Int
+ dynToInt (a :: Int) = a
+ dynToInt x = abort "Not an int"