2019年11月24日 星期日

使用flow.get和flow.set 將輸入輸出為數組的功能節點。

將輸入輸出為數組的功能節點。
使用flow.get和flow.set可以輕鬆應用其他流程。
在樹莓派中最好使用Pin輸入作為Pin輸出。 ^^




[{"id":"b173b2ed.d86b7","type":"inject","z":"58e45d0e.8e40d4","name":"0","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":96,"wires":[["b109d02f.4e774"]]},{"id":"8d9d37f5.8e4c78","type":"inject","z":"58e45d0e.8e40d4","name":"1","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":171.94094848632812,"y":134.0451464653015,"wires":[["b109d02f.4e774"]]},{"id":"d71cb5d8.0d4078","type":"inject","z":"58e45d0e.8e40d4","name":"0","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170.94098663330078,"y":179.04515552520752,"wires":[["ad353cda.ffc03"]]},{"id":"716af658.654708","type":"inject","z":"58e45d0e.8e40d4","name":"1","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":171.94097518920898,"y":217.0451521873474,"wires":[["ad353cda.ffc03"]]},{"id":"b109d02f.4e774","type":"function","z":"58e45d0e.8e40d4","name":"Pin1","func":"flow.set(\"pin1\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":315.99308586120605,"y":96.34375953674316,"wires":[["87374f36.90249"]]},{"id":"ad353cda.ffc03","type":"function","z":"58e45d0e.8e40d4","name":"Pin2","func":"flow.set(\"pin2\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":312.94100189208984,"y":177.04515552520752,"wires":[["87374f36.90249"]]},{"id":"87374f36.90249","type":"function","z":"58e45d0e.8e40d4","name":"Pin3","func":"\npin1=flow.get(\"pin1\")||0;\npin2=flow.get(\"pin2\")||0;\nif(pin1==1 && pin2==1){\n    pin3=1;\n}else{\n    pin3=0\n}\nflow.set(\"pin3\",pin3);\nmsg.payload=[pin1,pin2,pin3];\nreturn msg;","outputs":1,"noerr":0,"x":470.0035171508789,"y":95.34029626846313,"wires":[["936cab73.4a2ec8"]]},{"id":"936cab73.4a2ec8","type":"debug","z":"58e45d0e.8e40d4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":634.0034942626953,"y":93.63542127609253,"wires":[]},{"id":"1dac8814.d12028","type":"inject","z":"58e45d0e.8e40d4","name":"0","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":168.9408950805664,"y":328.04511165618896,"wires":[["4517be22.d6f65"]]},{"id":"31cd1f7e.e929d","type":"inject","z":"58e45d0e.8e40d4","name":"1","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170.88184356689453,"y":366.0902581214905,"wires":[["4517be22.d6f65"]]},{"id":"c8e52bc9.407008","type":"inject","z":"58e45d0e.8e40d4","name":"0","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":169.8818817138672,"y":411.0902671813965,"wires":[["7d34e94a.41d198"]]},{"id":"9cfcb8cc.0ce4f8","type":"inject","z":"58e45d0e.8e40d4","name":"1","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170.8818702697754,"y":449.0902638435364,"wires":[["7d34e94a.41d198"]]},{"id":"4517be22.d6f65","type":"function","z":"58e45d0e.8e40d4","name":"Pin1","func":"flow.set(\"pin1\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":314.93398094177246,"y":328.38887119293213,"wires":[["90bfcb51.a84098"]]},{"id":"7d34e94a.41d198","type":"function","z":"58e45d0e.8e40d4","name":"Pin2","func":"flow.set(\"pin2\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":311.88189697265625,"y":409.0902671813965,"wires":[["90bfcb51.a84098"]]},{"id":"90bfcb51.a84098","type":"function","z":"58e45d0e.8e40d4","name":"Pin3","func":"\npin1=flow.get(\"pin1\")||0;\npin2=flow.get(\"pin2\")||0;\nif(pin1==1 && pin2==1){\n    pin3=1;\n}else{\n    pin3=0\n}\nflow.set(\"pin3\",pin3);\nreturn msg;","outputs":1,"noerr":0,"x":461.94445419311523,"y":326.385440826416,"wires":[["bc2c50a3.91dc6"]]},{"id":"bc2c50a3.91dc6","type":"function","z":"58e45d0e.8e40d4","name":"Output 3","func":"msg.payload = flow.get(\"pin1\");\nvar msg1 = {payload : flow.get(\"pin2\")};\nvar msg2 = {payload : flow.get(\"pin3\")};\n\nreturn [msg,msg1,msg2];","outputs":3,"noerr":0,"x":603.9964790344238,"y":327.33678245544434,"wires":[["4cbf66c1.0d1738"],["34ed4389.c72e1c"],["16118cdd.7119d3"]]},{"id":"4cbf66c1.0d1738","type":"debug","z":"58e45d0e.8e40d4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":796.9999771118164,"y":313.6353930234909,"wires":[]},{"id":"34ed4389.c72e1c","type":"debug","z":"58e45d0e.8e40d4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":799.9408798217773,"y":353.0450838804245,"wires":[]},{"id":"16118cdd.7119d3","type":"debug","z":"58e45d0e.8e40d4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":802.9408798217773,"y":393.0450838804245,"wires":[]},{"id":"a4f3c52.5d75b38","type":"comment","z":"58e45d0e.8e40d4","name":"Pin Output (Array)","info":"","x":183.0034408569336,"y":47.194430351257324,"wires":[]},{"id":"6ba186f0.92cf08","type":"comment","z":"58e45d0e.8e40d4","name":"3 Pin Output","info":"","x":162.94094848632812,"y":284.045108795166,"wires":[]}]

沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) Node-Red 程式 [{"id":"d8886...