Control a Piglow using Node-RED
Control a Piglow using Node-RED
By taking advantage of the node-piglow module, you can now control your Piglow using Node-RED.
Steps
- Install the node-piglow module:
npm install node-piglow
should do it. - Add node-piglow to the node-red settings.js in the functionGlobalContext:
functionGlobalContext: { piglow:require('piglow') }
- Launch Node-RED and add the flow below and start hacking! Check out the documentation here to see what you can do.
-James
[{"id":"185ab0fd.e7a54f","type":"inject","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":370,"y":180,"z":"56b706ba.a948f8","wires":[["5d792c19.a286d4"]]},{"id":"5d792c19.a286d4","type":"function","name":"Control Piglow","func":"var piGlow = context.global.piglow;\n\n\n//callback fires when board is initialized\npiGlow(function(error, pi) {\n\t\tpi.random;\n});\n\n\nreturn msg;","outputs":1,"x":554,"y":180,"z":"56b706ba.a948f8","wires":[[]]}]