HouseMon Circuits Tutorial-1.07

In circuit 6, we introduced the ‘Delay’ gadget. It delayed its input by a provided ‘duration’ before emitting it onto its .Out pin.

Today we introduce the ‘FanOut’ gadget.

FanOut is a little ‘special’ in that its .Out pins a created dynamically at circuit construction time. More specifically the gadget is told what .Out pins it must provide via the assignments made in the ‘wire’ section of the circuit definition.

All .Out pins output the same data, (that which is provided to its .In pin). The order that the output is produced should be considered ‘random’ in that if you assign to 3 output pins, you may get your input sent to .Out:pin2, .Out:pin3 and finally .Out:pin1.

Did you note the format of the .Out pin assignments above? .Out [colon] [name], as in .Out:pin1 .

Lets change to the housemon folder, and review circuit 7:

$ ./cirget circuit 7
$ ./cirget -y

I’ve included the circuit below. Note the ‘FanOut’ (Line 19-20).

#Read a Text file, output first delayed by 200ms, then sent to FanOut, and then
console line printer.
        name: "dummy"
        type: "Pipe"
        name: "rft"
        type: "ReadFileText"
        name: "p"
        type: "Printer"
        name: "d"
        type: "Delay"
        name: "fo"
        type: "FanOut"
        from: "rft.Out"
        to: "d.In"
        from: "d.Out"
        to: "fo.In"
        from: "fo.Out:pin1"
        to: "p.In"
        data: "setup.json"
        to: "rft.In"
        data: "200ms"
        to: "d.Delay"
        external: "In"
        internal: "dummy.In"
        external: "Out"
        internal: "dummy.Out"

You will note that the ‘wires:’ section has been adjusted to put the ‘FanOut’ after the ‘Delay’ but before the ‘Printer’. Pay attention to the name of the ‘Fanout’ .Out pin – here we named it “pin1” as in ‘fo.Out:pin1’. We could have called this pin ‘fo.Out:foobar’ and the result would be the same.

The ‘FanOut’ gadget, when included like this, does nothing different than the previous circuit. Infact we have just ‘lengthened’ our circuit with no real benefit (apart from your new knowledge of FanOut’s existance 🙂 ). We will see how ‘FanOut’ can be used to help branch our messages to be processed in different ways in the next tutorials.

Posted in cirget, housemon, housemon tutorials, soft-circuits

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: