Input and Output controls for Pibrella on Raspberry Pi

A set of configured gpio-in and gpio-out nodes to control the Pimoroni Pibrella

http://shop.pimoroni.com/products/pibrella

Copy and paste them into your own Pibrella applications.

Click a 1 or 0 injector to turn an LED on or off.

Pressing the RED button, or closing one of the four digital inputs gives a debug output (1 then 0).

Note this flow needs the latest version of the gpio-in/out nodes, as it uses I/O pins not listed in the original version of the nodes.

I've also included a couple of demos:

A traffic light simulator - press the "initialise" injector to set initial "green", and then press the RED button to activate the sequence.

Also an input to output mapper example - short two of the input pins and the matching output pin lights up.

[{"id":"81c3898d.c0faa","type":"inject","name":"","topic":"","payload":"0","repeat":"","crontab":"","once":false,"x":365.6825180053711,"y":216.92065048217773,"z":"cc001791.3a6ca","wires":[["221ed5a4.1d9c8a"]]},{"id":"996178aa.66d6","type":"inject","name":"","topic":"","payload":"1","repeat":"","crontab":"","once":false,"x":363.6825180053711,"y":256.92065048217773,"z":"cc001791.3a6ca","wires":[["221ed5a4.1d9c8a"]]},{"id":"221ed5a4.1d9c8a","type":"rpi-gpio out","name":"green","pin":"7","x":500.6825180053711,"y":236.92065048217773,"z":"cc001791.3a6ca","wires":[]},{"id":"ccb6231b.1f219","type":"inject","name":"","topic":"","payload":"0","repeat":"","crontab":"","once":false,"x":366.6825180053711,"y":129.92065048217773,"z":"cc001791.3a6ca","wires":[["59cc9836.48fee"]]},{"id":"59cc9836.48fee","type":"rpi-gpio out","name":"amber","pin":"11","x":502.6825180053711,"y":149.92065048217773,"z":"cc001791.3a6ca","wires":[]},{"id":"e8600d51.54b29","type":"inject","name":"","topic":"","payload":"1","repeat":"","crontab":"","once":false,"x":364.6825180053711,"y":169.92065048217773,"z":"cc001791.3a6ca","wires":[["59cc9836.48fee"]]},{"id":"ec19b0ba.ad88a8","type":"inject","name":"","topic":"","payload":"0","repeat":"","crontab":"","once":false,"x":739.5833206176758,"y":244.38094902038574,"z":"cc001791.3a6ca","wires":[["8a9e4414.0fc4b"]]},{"id":"8a9e4414.0fc4b","type":"rpi-gpio out","name":"OUT E","pin":"15","x":913.6944351196289,"y":257.4920892715454,"z":"cc001791.3a6ca","wires":[]},{"id":"fc550dc4.8f438","type":"inject","name":"","topic":"","payload":"1","repeat":"","crontab":"","once":false,"x":737.5833206176758,"y":284.38094902038574,"z":"cc001791.3a6ca","wires":[["8a9e4414.0fc4b"]]},{"id":"d271e379.408778","type":"inject","name":"","topic":"","payload":"0","repeat":"","crontab":"","once":false,"x":367.6825180053711,"y":42.920650482177734,"z":"cc001791.3a6ca","wires":[["c6a3a3ff.e08d8"]]},{"id":"c6a3a3ff.e08d8","type":"rpi-gpio out","name":"red","pin":"13","x":505.6825180053711,"y":64.92065048217773,"z":"cc001791.3a6ca","wires":[]},{"id":"d05207f4.44e508","type":"inject","name":"","topic":"","payload":"1","repeat":"","crontab":"","once":false,"x":365.6825180053711,"y":82.92065048217773,"z":"cc001791.3a6ca","wires":[["c6a3a3ff.e08d8"]]},{"id":"7ad6d8f2.07f64","type":"inject","name":"","topic":"","payload":"0","repeat":"","crontab":"","once":false,"x":737.5833206176758,"y":329.38094902038574,"z":"cc001791.3a6ca","wires":[["87debb3d.341fe"]]},{"id":"87debb3d.341fe","type":"rpi-gpio out","name":"OUT F","pin":"16","x":911.6944351196289,"y":342.4920892715454,"z":"cc001791.3a6ca","wires":[]},{"id":"977c6ad9.bfead8","type":"inject","name":"","topic":"","payload":"1","repeat":"","crontab":"","once":false,"x":735.5833206176758,"y":369.38094902038574,"z":"cc001791.3a6ca","wires":[["87debb3d.341fe"]]},{"id":"3fe31925.5a0f86","type":"inject","name":"","topic":"","payload":"0","repeat":"","crontab":"","once":false,"x":736.5833206176758,"y":416.38094902038574,"z":"cc001791.3a6ca","wires":[["b3be2476.800a8"]]},{"id":"b3be2476.800a8","type":"rpi-gpio out","name":"OUT G","pin":"18","x":912.6944351196289,"y":431.4920892715454,"z":"cc001791.3a6ca","wires":[]},{"id":"5b9725d8.cd656c","type":"inject","name":"","topic":"","payload":"1","repeat":"","crontab":"","once":false,"x":736.5833206176758,"y":458.38094902038574,"z":"cc001791.3a6ca","wires":[["b3be2476.800a8"]]},{"id":"c938ef46.937ea","type":"inject","name":"","topic":"","payload":"0","repeat":"","crontab":"","once":false,"x":734.5833206176758,"y":504.38094902038574,"z":"cc001791.3a6ca","wires":[["d225061b.9edee"]]},{"id":"d225061b.9edee","type":"rpi-gpio out","name":"OUT H","pin":"22","x":909.6944351196289,"y":515.4920892715454,"z":"cc001791.3a6ca","wires":[]},{"id":"4158206e.f459","type":"inject","name":"","topic":"","payload":"1","repeat":"","crontab":"","once":false,"x":733.5833206176758,"y":542.3809490203857,"z":"cc001791.3a6ca","wires":[["d225061b.9edee"]]},{"id":"8c19de6.a3f2ea","type":"rpi-gpio in","name":"red button","intype":"tri","pin":"23","x":391.23812103271484,"y":567.6508026123047,"z":"cc001791.3a6ca","wires":[["2a1f4d0b.922f5a"]]},{"id":"2a1f4d0b.922f5a","type":"debug","name":"red button","active":true,"complete":"false","x":520.2380752563477,"y":567.7619142532349,"z":"cc001791.3a6ca","wires":[]},{"id":"c21a5d4e.881bb","type":"rpi-gpio in","name":"red button","intype":"tri","pin":"23","x":174.99998474121094,"y":930.6667013168335,"z":"cc001791.3a6ca","wires":[["8e841011.730c28"]]},{"id":"58018674.6491c","type":"rpi-gpio out","name":"red","pin":"13","x":695.9999847412109,"y":1044.6667013168335,"z":"cc001791.3a6ca","wires":[]},{"id":"d0015e8a.b27fd","type":"rpi-gpio out","name":"green","pin":"7","x":1030.999984741211,"y":1154.6667013168335,"z":"cc001791.3a6ca","wires":[]},{"id":"d0a4cf73.a8488","type":"rpi-gpio out","name":"amber","pin":"11","x":519.9999847412109,"y":995.6667013168335,"z":"cc001791.3a6ca","wires":[]},{"id":"670b47e2.99725","type":"delay","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","x":516.9999847412109,"y":1043.6667013168335,"z":"cc001791.3a6ca","wires":[["58018674.6491c","39dc1201.3cd046","91343e25.b6fda"]]},{"id":"39dc1201.3cd046","type":"delay","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","x":697.9999847412109,"y":1090.6667013168335,"z":"cc001791.3a6ca","wires":[["8491f027.37a2e8","50fbbde3.dbd4bc"]]},{"id":"8491f027.37a2e8","type":"rpi-gpio out","name":"amber","pin":"11","x":871.9999847412109,"y":1090.6667013168335,"z":"cc001791.3a6ca","wires":[]},{"id":"50fbbde3.dbd4bc","type":"delay","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","x":886.9999847412109,"y":1153.6667013168335,"z":"cc001791.3a6ca","wires":[["d0015e8a.b27fd","5140217b.a0f5f"]]},{"id":"91343e25.b6fda","type":"function","name":"0","func":"msg.payload = 0;\n\n\nreturn msg;","outputs":1,"x":699.9999847412109,"y":1001.6667013168335,"z":"cc001791.3a6ca","wires":[["ab7b3db2.4a8e38"]]},{"id":"ab7b3db2.4a8e38","type":"rpi-gpio out","name":"amber","pin":"11","x":846.9999847412109,"y":1001.6667013168335,"z":"cc001791.3a6ca","wires":[]},{"id":"5140217b.a0f5f","type":"function","name":"0","func":"msg.payload = 0;\n\n\nreturn msg;","outputs":1,"x":1028.999984741211,"y":1113.6667013168335,"z":"cc001791.3a6ca","wires":[["a57366b1.9a71e","b0cbbff.5ac57c"]]},{"id":"b0cbbff.5ac57c","type":"rpi-gpio out","name":"red","pin":"13","x":1184.999984741211,"y":1125.6667013168335,"z":"cc001791.3a6ca","wires":[]},{"id":"a57366b1.9a71e","type":"rpi-gpio out","name":"amber","pin":"11","x":1182.999984741211,"y":1081.6667013168335,"z":"cc001791.3a6ca","wires":[]},{"id":"8e841011.730c28","type":"function","name":"rising edge","func":"if (msg.payload == 1)\n{\n  return msg;\n}\nelse\n{\n  return null;\n}\n","outputs":1,"x":309.99998474121094,"y":931.6667013168335,"z":"cc001791.3a6ca","wires":[["d0a4cf73.a8488","670b47e2.99725","946e951a.64c3d"]]},{"id":"946e951a.64c3d","type":"function","name":"0","func":"msg.payload = 0;\n\n\nreturn msg;","outputs":1,"x":520.9999847412109,"y":946.6667013168335,"z":"cc001791.3a6ca","wires":[["c0158c36.e5d32"]]},{"id":"c0158c36.e5d32","type":"rpi-gpio out","name":"green","pin":"7","x":677.9999847412109,"y":945.6667013168335,"z":"cc001791.3a6ca","wires":[]},{"id":"640a18e3.85bfe","type":"inject","name":"initialise to green","topic":"","payload":"1","repeat":"","crontab":"","once":false,"x":183.99998474121094,"y":847.6666870117188,"z":"cc001791.3a6ca","wires":[["7c56374b.33a618"]]},{"id":"9660927c.4def38","type":"rpi-gpio out","name":"green","pin":"7","x":508.99998474121094,"y":861.6667013168335,"z":"cc001791.3a6ca","wires":[]},{"id":"95fe3a15.23891","type":"function","name":"0","func":"msg.payload = 0;\n\n\nreturn msg;","outputs":1,"x":514.9999847412109,"y":808.6667013168335,"z":"cc001791.3a6ca","wires":[["694134a.39930cc","4352acc7.cc7f04"]]},{"id":"694134a.39930cc","type":"rpi-gpio out","name":"amber","pin":"11","x":652.9999847412109,"y":785.6667013168335,"z":"cc001791.3a6ca","wires":[]},{"id":"4352acc7.cc7f04","type":"rpi-gpio out","name":"red","pin":"13","x":650.9999847412109,"y":830.6667013168335,"z":"cc001791.3a6ca","wires":[]},{"id":"7c56374b.33a618","type":"delay","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","x":342.99998474121094,"y":848.6667013168335,"z":"cc001791.3a6ca","wires":[["95fe3a15.23891","9660927c.4def38"]]},{"id":"856a0bec.a54248","type":"rpi-gpio in","name":"IN A","intype":"tri","pin":"21","x":110.64286422729492,"y":357.8928699493408,"z":"cc001791.3a6ca","wires":[["96997748.6205c8"]]},{"id":"96997748.6205c8","type":"debug","name":"IN A","active":true,"complete":"false","x":260.6428680419922,"y":356.8928680419922,"z":"cc001791.3a6ca","wires":[]},{"id":"7c76215a.1014a","type":"rpi-gpio in","name":"IN B","intype":"tri","pin":"26","x":104.64286804199219,"y":409.8928680419922,"z":"cc001791.3a6ca","wires":[["f44648db.159108"]]},{"id":"f44648db.159108","type":"debug","name":"IN B","active":true,"complete":"false","x":254.6428680419922,"y":408.8928680419922,"z":"cc001791.3a6ca","wires":[]},{"id":"ac83880c.cb66c8","type":"rpi-gpio in","name":"IN C","intype":"tri","pin":"24","x":106.64286804199219,"y":455.8928680419922,"z":"cc001791.3a6ca","wires":[["2bd03b9.f89f8c4"]]},{"id":"2bd03b9.f89f8c4","type":"debug","name":"IN C","active":true,"complete":"false","x":256.6428680419922,"y":454.8928680419922,"z":"cc001791.3a6ca","wires":[]},{"id":"2ec8ca16.e4fa26","type":"rpi-gpio in","name":"IN D","intype":"tri","pin":"19","x":108.64286804199219,"y":500.8928680419922,"z":"cc001791.3a6ca","wires":[["c41b9536.853c6"]]},{"id":"c41b9536.853c6","type":"debug","name":"IN D","active":true,"complete":"false","x":258.6428680419922,"y":499.8928680419922,"z":"cc001791.3a6ca","wires":[]},{"id":"ccb5713d.511e2","type":"rpi-gpio in","name":"IN A","intype":"tri","pin":"21","x":257.8888854980469,"y":1324.222412109375,"z":"cc001791.3a6ca","wires":[["61718507.4e96bc"]]},{"id":"b446a5cf.2c15a8","type":"rpi-gpio in","name":"IN B","intype":"tri","pin":"26","x":257.6667022705078,"y":1367.0001220703125,"z":"cc001791.3a6ca","wires":[["82ab5e9c.cc2608"]]},{"id":"124db4b5.d312ab","type":"rpi-gpio in","name":"IN C","intype":"tri","pin":"24","x":257.7778015136719,"y":1411,"z":"cc001791.3a6ca","wires":[["86e116da.b454d"]]},{"id":"dcd98b57.41f5d8","type":"rpi-gpio in","name":"IN D","intype":"tri","pin":"19","x":254.44447326660156,"y":1458.2222900390625,"z":"cc001791.3a6ca","wires":[["7b79fcf0.c3b3bc"]]},{"id":"61718507.4e96bc","type":"rpi-gpio out","name":"OUT E","pin":"15","x":396.4444580078125,"y":1325.2225341796875,"z":"cc001791.3a6ca","wires":[]},{"id":"82ab5e9c.cc2608","type":"rpi-gpio out","name":"OUT F","pin":"16","x":394.55560302734375,"y":1366.7779541015625,"z":"cc001791.3a6ca","wires":[]},{"id":"86e116da.b454d","type":"rpi-gpio out","name":"OUT G","pin":"18","x":391.2222595214844,"y":1411.444580078125,"z":"cc001791.3a6ca","wires":[]},{"id":"7b79fcf0.c3b3bc","type":"rpi-gpio out","name":"OUT H","pin":"22","x":393.7778015136719,"y":1458.666748046875,"z":"cc001791.3a6ca","wires":[]},{"id":"363930ed.65ddd8","type":"comment","name":"mirror input pin to output pin","info":"","x":239.7777557373047,"y":1248.5556640625,"z":"cc001791.3a6ca","wires":[]},{"id":"33a56a17.2e2c9e","type":"comment","name":"traffic light simulator - push the red button!","info":"","x":260,"y":753.3334197998047,"z":"cc001791.3a6ca","wires":[]}]
andysc

Flow Info

created 3 years, 4 months ago

Node Types

Core
  • comment (x2)
  • debug (x5)
  • delay (x4)
  • function (x5)
  • inject (x15)
  • rpi-gpio in (x10)
  • rpi-gpio out (x22)

Tags

  • raspberry
  • pi
  • pibrella
  • pimoroni
  • gpio
  • LED
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option