Created
November 10, 2015 19:51
-
-
Save mikedewar/f7b9f0b30beebcc1bf8f to your computer and use it in GitHub Desktop.
streamtools counter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"label":"root","blocks":[{"label":"","type":"latch","id":1,"inputs":[{"name":"in","value":null,"type":"any"},{"name":"ctrl","value":null,"type":"boolean"}],"outputs":[{"name":"true","type":"any"},{"name":"false","type":"any"}],"source":null,"position":{"x":358,"y":348}},{"label":"","type":"first","id":2,"inputs":[{"name":"in","value":null,"type":"any"}],"outputs":[{"name":"first","type":"boolean"}],"source":null,"position":{"x":249,"y":417}},{"label":"","type":"identity","id":4,"inputs":[{"name":"in","value":{"data":0},"type":"any"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":147,"y":320}},{"label":"","type":"delay","id":10,"inputs":[{"name":"in","value":{"data":true},"type":"any"},{"name":"duration","value":{"data":"1s"},"type":"string"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":367,"y":544}},{"label":"","type":"gate","id":11,"inputs":[{"name":"in","value":null,"type":"any"},{"name":"ctrl","value":null,"type":"any"}],"outputs":[{"name":"out","type":"any"}],"source":null,"position":{"x":551,"y":493}},{"label":"","type":"+","id":13,"inputs":[{"name":"x","value":null,"type":"number"},{"name":"y","value":{"data":1},"type":"number"}],"outputs":[{"name":"x+y","type":"number"}],"source":null,"position":{"x":552,"y":379}},{"label":"","type":"log","id":17,"inputs":[{"name":"log","value":null,"type":"any"}],"outputs":[],"source":null,"position":{"x":704,"y":332}}],"connections":[{"from":{"id":2,"route":0},"to":{"id":1,"route":1},"id":3},{"from":{"id":4,"route":0},"to":{"id":1,"route":0},"id":5},{"from":{"id":4,"route":0},"to":{"id":2,"route":0},"id":6},{"from":{"id":1,"route":0},"to":{"id":13,"route":0},"id":16},{"from":{"id":10,"route":0},"to":{"id":11,"route":1},"id":12},{"from":{"id":13,"route":0},"to":{"id":11,"route":0},"id":14},{"from":{"id":11,"route":0},"to":{"id":13,"route":0},"id":15},{"from":{"id":13,"route":0},"to":{"id":17,"route":0},"id":18}],"groups":[{"id":0,"label":"root","children":[1,2,4,10,11,13,17],"position":{"x":0,"y":0}}],"sources":[],"links":[]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this counts in increments of 1, starting from an initial condition. This example is a simple way of exploring the latch (top-middle) and the gate (bottom-right).
It works as follows:
0
which is set as its in-route's value.true
when it receives the first0
, and true thereafter0
and the first block'strue
message, the latch emits0
on its true route.+
block adds 1, emitting1
. This is seen in the log, and also sent to the gate block.true
which is set as its in-route's value.1
from the add block and thetrue
from the delay block, it emits the1
to the addition block.1
message, the addition block adds 1, emitting2
back to the gate, which then waits for the delay bock to emittrue
again, when it emits2
on its out-route to the addition block