Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Output Node ====== The OutputNode sketch, and matching Lua class, exposes the digital ports 1-4 as I/O controllable xAPBSC endpoints. If not all ports are not being used they can be individually disabled by leaving them out of the endpoint definition or by setting their value to 0 (zero). {{:livebox:output-node-sequence-diagram.png|}} Snippet of configuration information needed in the jeenodeApplet.lua source. Here we are sending to an RF node configured as unit 8 (the default for the OutputNode Sketch). <code> OutputNode = require("xap.outputnode") local nodes = { [8]=OutputNode{instance="jeenode:attic",endpoints={p1=1,p2=1,p3=1,p4=1}} } </code> So now we can simply use a xAPBSC.cmd class message to control these newly created endpoints. Here is an example of turning on JeeNode Port 1 from the above configuration. <code> xap-header { v=12 hop=1 uid=FF000F00 class=xAPBSC.cmd source=dbzoo.livebox.demo target=dbzoo.livebox.jeenode:attic.p1 } output.state.1 { id=* state=on } </code> This would result in the OutputNode lua code sending to xap-serial the following <code> xap-header { uid=FF00D800 source=dbzoo.livebox.Plugboard hop=1 class=Serial.Comms target=dbzoo.livebox.serial v=12 } Serial.Send { data=1,1,8 s port=/dev/ttyUSB0 } </code> Controlling an OutputNode from the Joggler in this video we simply toggle 4x LEDs on/off. [[http://www.youtube.com/watch?v=5JBmlpjOBqw|HAH remote control of JeeNodes using a Joggler]] This node provides the following endpoints (p1,p2,p3,p4) for example: <code> dbzoo.livebox.jeenode:attic.p1 dbzoo.livebox.jeenode:attic.p2 dbzoo.livebox.jeenode:attic.p3 dbzoo.livebox.jeenode:attic.p4 </code> We can rename them like this to produce ''dbzoo.livebox.jeenode:attic.port1'' etc.. <code> local nodes = { [ID]=OutputNode{instance="jeenode:attic",endpoints={p1="port1",p2="port2",p3="port3",p4="port4"}} } </code> ====== Debugging ====== Flash the HAHCentral and Output nodes sketches, tethering each to your computer. Connect to each @ 57600 baud. When powered on the following should be displayed <code> [HAHCentral.1]1 g212 @ 868Mhz OK 8 0 </code> <code> [outputNode.1] i8 g212 @ 868Mhz OUTPUT 0 0 0 0 0 </code> Entering a command on the HAHCentral to toggle a Port on and off. The command will not be displayed as its typed into the sketch terminal window. Enter command 1,1,8s (PORT 1,ON,NODE 8) then 1,0,8s (PORT 1,OFF,NODE 8) <code> [HAHCentral.1]1 g212 @ 868Mhz OK 8 0 > 8s -> 2 b > 8s -> 2 b </code> The sketch will display "> 8s" when the "s" letter is sent, no CR/LF is necessary. The next line "-> 2 b" indicates that two bytes of data where transmitted. The output on the other side will now look like this: <code> [outputNode.1] i8 g212 @ 868Mhz OUTPUT 0 0 0 0 0 GOT 1 1 Port 1 set on GOT 1 0 Port 1 set off </code> livebox/hah_hahnode/outputnode.txt Last modified: 2015/02/03 09:53by brett