This flow allows to blink a LED on Raspberry PI until you want to stop it.
-
-
Save IgnacioRubio/3dbd62dfa8f6db78a598d0c7263f0f97 to your computer and use it in GitHub Desktop.
Blinking a LED on Raspberry PI
This file contains 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
[{"id":"740a99d2.b07d1","type":"function","z":"b71ac87f.d81188","name":"startBlink","func":"var BLINKDELAY = 250;\n\nvar light = true;\n\n\nvar blinker = setInterval(blink, BLINKDELAY);\n\nglobal.set(\"blinker\", blinker);\n\nfunction blink () {\n \n if (light) {\n msg.payload = 1;\n light = false;\n }\n \n else {\n msg.payload = 0;\n light = true;\n }\n \n node.send(msg);\n}\n\n\nreturn;","outputs":1,"noerr":0,"x":282,"y":153,"wires":[["41b167bc.bbffc"]]},{"id":"73f5f278.0231bc","type":"inject","z":"b71ac87f.d81188","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":126,"y":153,"wires":[["740a99d2.b07d1"]]},{"id":"41b167bc.bbffc","type":"rpi-gpio out","z":"b71ac87f.d81188","name":"","pin":"15","set":"","level":"0","out":"out","x":471,"y":153,"wires":[]},{"id":"cc1b11b1.bebb28","type":"function","z":"b71ac87f.d81188","name":"stopBlink","func":"clearInterval(global.get(\"blinker\"));\n\nmsg.payload = 0;\n\nreturn msg;","outputs":1,"noerr":0,"x":288,"y":225,"wires":[["41b167bc.bbffc"]]},{"id":"5db82a6c.1b547c","type":"inject","z":"b71ac87f.d81188","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":123,"y":226,"wires":[["cc1b11b1.bebb28"]]}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment