Created
November 10, 2015 19:51
-
-
Save mikedewar/f7b9f0b30beebcc1bf8f to your computer and use it in GitHub Desktop.
streamtools counter
This file contains hidden or 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":[]} |
Author
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:
0which is set as its in-route's value.truewhen it receives the first0, and true thereafter0and the first block'struemessage, the latch emits0on its true route.+block adds 1, emitting1. This is seen in the log, and also sent to the gate block.truewhich is set as its in-route's value.1from the add block and thetruefrom the delay block, it emits the1to the addition block.1message, the addition block adds 1, emitting2back to the gate, which then waits for the delay bock to emittrueagain, when it emits2on its out-route to the addition block