Created
November 2, 2014 05:01
-
-
Save anoochit/ed4d9ab9a131abfa0678 to your computer and use it in GitHub Desktop.
node-red-blink
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":"9ce896f9.631768","type":"function","name":"Toggle LED on input","func":"\n// select wpi pin 0 = pin 11 on header (for v2)\nvar pin = 7;\n\n// initialise the wpi to use the global context\nvar wpi = context.global.wpi;\n\n// use the default WiringPi pin number scheme...\nwpi.setup();\n\n// initialise the state of the pin if not already set\n// anything in context. persists from one call to the function to the next\ncontext.state = context.state || wpi.LOW;\n\n// set the mode to output (just in case)\nwpi.pinMode(pin, wpi.modes.OUTPUT);\n\n// toggle the stored state of the pin\n(context.state == wpi.LOW) ? context.state = wpi.HIGH : context.state = wpi.LOW;\n\n// output the state to the pin\nwpi.digitalWrite(pin, context.state);\n\n// we don't \"need\" to return anything here but may help for debug\nreturn msg;","outputs":1,"x":343,"y":87,"z":"3146639d.ceb99c","wires":[["68737402.978c8c"]]},{"id":"dd344d18.22cbb","type":"inject","name":"tick","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"x":123,"y":67,"z":"3146639d.ceb99c","wires":[["9ce896f9.631768"]]},{"id":"68737402.978c8c","type":"debug","name":"","active":true,"x":563,"y":107,"z":"3146639d.ceb99c","wires":[]}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment