First experiment with node-red and the arudino sensor

by 09:13 0 commenti
Install the serial node available here



copy and past the following code as a new node

[{"id":"30027b17.72d55c","type":"serial-port","serialport":"/dev/ttyACM0","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"false","out":"char","addchar":false},{"id":"320157f5.4a3218","type":"serial in","name":"get sensor data","serial":"30027b17.72d55c","x":143.75,"y":190.75,"z":"aa1bdbb1.17fda8","wires":[["919ea5fa.6e6158","fffa749f.000588"]]},{"id":"919ea5fa.6e6158","type":"switch","name":"Analog Sensor Condition","property":"payload","rules":[{"t":"gt","v":"2.5"},{"t":"lte","v":"2.5"}],"checkall":"true","outputs":2,"x":403,"y":328,"z":"aa1bdbb1.17fda8","wires":[["96274206.69d8c"],["1064450d.ef9bbb"]]},{"id":"814c7529.7eb388","type":"serial out","name":"send command","serial":"30027b17.72d55c","x":431,"y":669,"z":"aa1bdbb1.17fda8","wires":[]},{"id":"768ea2e0.89715c","type":"inject","name":"ON","topic":"","payload":"3","payloadType":"string","repeat":"","crontab":"","once":false,"x":146,"y":771,"z":"aa1bdbb1.17fda8","wires":[["d164304a.2e9bd","814c7529.7eb388"]]},{"id":"d164304a.2e9bd","type":"debug","name":"","active":true,"console":"false","complete":"false","x":429,"y":577,"z":"aa1bdbb1.17fda8","wires":[]},{"id":"fffa749f.000588","type":"debug","name":"","active":false,"console":"false","complete":"false","x":344,"y":74,"z":"aa1bdbb1.17fda8","wires":[]},{"id":"589e1082.a761f","type":"serial out","name":"send command","serial":"30027b17.72d55c","x":910,"y":672,"z":"aa1bdbb1.17fda8","wires":[]},{"id":"f0b035d5.0f4fc8","type":"inject","name":"OFF","topic":"","payload":"4","payloadType":"string","repeat":"","crontab":"","once":false,"x":652,"y":778,"z":"aa1bdbb1.17fda8","wires":[["7b33944d.84cc6c","589e1082.a761f"]]},{"id":"7b33944d.84cc6c","type":"debug","name":"","active":true,"console":"false","complete":"false","x":902,"y":593,"z":"aa1bdbb1.17fda8","wires":[]},{"id":"96274206.69d8c","type":"function","name":"msg ON","func":"msg.payload=\"3\";\nreturn msg;","outputs":1,"noerr":0,"x":659,"y":219,"z":"aa1bdbb1.17fda8","wires":[["630a10ec.9cf5f","30d77156.cf288e"]]},{"id":"630a10ec.9cf5f","type":"debug","name":"","active":true,"console":"false","complete":"false","x":927,"y":97,"z":"aa1bdbb1.17fda8","wires":[]},{"id":"1064450d.ef9bbb","type":"function","name":"msg OFF","func":"msg.payload=\"4\";\nreturn msg;","outputs":1,"noerr":0,"x":680,"y":366,"z":"aa1bdbb1.17fda8","wires":[["956994c9.6a9668","30d77156.cf288e"]]},{"id":"956994c9.6a9668","type":"debug","name":"","active":true,"console":"false","complete":"false","x":901,"y":502,"z":"aa1bdbb1.17fda8","wires":[]},{"id":"30d77156.cf288e","type":"serial out","name":"send command","serial":"30027b17.72d55c","x":959,"y":279,"z":"aa1bdbb1.17fda8","wires":[]}]

andrea

Developer

Cras justo odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

0 commenti:

Posta un commento

Nota. Solo i membri di questo blog possono postare un commento.