整合樹梅派GPIO

整合GPIO

sudo apt-get update && sudo apt-get install python-rpi.gpio
sudo adduser $USER gpio

測試 PIN7 的開關

[{"id":"3c810a68.1d3c26","type":"tab","label":"GPIO test","disabled":true,"info":""},{"id":"3c14e65d.7d5c7a","type":"function","z":"3c810a68.1d3c26","name":"從 input 切換 0/1","func":"\ncontext.state = context.state || 0;\n\n(context.state == 0) ? context.state = 1 : context.state = 0;\nmsg.payload = context.state;\n\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":220,"wires":[["839d7a3e.260f08","9e999a30.9b66d8"]]},{"id":"839d7a3e.260f08","type":"debug","z":"3c810a68.1d3c26","name":"","active":true,"x":669,"y":280.0000009536743,"wires":[]},{"id":"519a376.1ba83c8","type":"inject","z":"3c810a68.1d3c26","name":"每秒閃爍","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"onceDelay":"","x":209,"y":220.00000095367432,"wires":[["3c14e65d.7d5c7a"]]},{"id":"9e999a30.9b66d8","type":"rpi-gpio out","z":"3c810a68.1d3c26","name":"","pin":"7","set":false,"freq":"","out":"out","x":666.8333625793457,"y":219.8333339691162,"wires":[]}]

Last updated