function雙重條件使用範例。
這是自動(自動/手動)且大於等於125(120/130)時輸出操作的示例。
[{"id":"7c31a2ef.b3970c","type":"inject","z":"246f77ce.0477c8","name":"","topic":"自動","payload":"auto","payloadType":"str","repeat":"2","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":500,"wires":[["74d3e332.4c333c"]]},{"id":"da9ad0de.7eefe","type":"inject","z":"246f77ce.0477c8","name":"","topic":"手動","payload":" Manual","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":540,"wires":[["74d3e332.4c333c"]]},{"id":"ca994ed8.9a45c","type":"inject","z":"246f77ce.0477c8","name":"","topic":"","payload":"120","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":640,"wires":[["144e3c8d.5b0fa3"]]},{"id":"26aa586e.2cf258","type":"inject","z":"246f77ce.0477c8","name":"","topic":"","payload":"130","payloadType":"num","repeat":"5","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":600,"wires":[["144e3c8d.5b0fa3"]]},{"id":"74d3e332.4c333c","type":"function","z":"246f77ce.0477c8","name":"自動/手動","func":"if(msg.payload === \"auto\"){\n flow.set(\"autonum\",1);\n}else{\n flow.set(\"autonum\",0);\n}\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":500,"wires":[["28cdb891.77e108","c39e152d.0cbd28"]]},{"id":"144e3c8d.5b0fa3","type":"function","z":"246f77ce.0477c8","name":" 溫度範圍","func":"if(msg.payload > 125){\n flow.set(\"tempnum\",1);\n}else{\n flow.set(\"tempnum\",0);\n}\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":620,"wires":[["28cdb891.77e108","6c374b78.858814"]]},{"id":"28cdb891.77e108","type":"function","z":"246f77ce.0477c8","name":"On/Off","func":"var autonum = flow.get(\"autonum\")||0;\nvar tempnum = flow.get(\"tempnum\")||0;\nvar num = autonum + tempnum;\n\nif(num >= 2){\n msg.payload = \"運作\"+num ;\n}else{\n msg.payload = \"停下\"+num ;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":590,"y":500,"wires":[["b3d2c11e.eee3d"]]},{"id":"b3d2c11e.eee3d","type":"debug","z":"246f77ce.0477c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":750,"y":500,"wires":[]},{"id":"26686b7b.c85634","type":"comment","z":"246f77ce.0477c8","name":" 雙重條件表達式","info":"","x":200,"y":440,"wires":[]},{"id":"c39e152d.0cbd28","type":"debug","z":"246f77ce.0477c8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":590,"y":440,"wires":[]},{"id":"6c374b78.858814","type":"debug","z":"246f77ce.0477c8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":570,"y":620,"wires":[]}]
2019年11月23日 星期六
訂閱:
張貼留言 (Atom)
113 學年度第 1 學期 RFID應用課程 Arduino程式
113 學年度第 1 學期 RFID應用課程 Arduino程式 https://www.mediafire.com/file/zr0h0p3iosq12jw/MFRC522+(2).7z/file 內含修改過後的 MFRC522 程式庫 (原程式有錯誤) //定義MFRC522...
-
python pip 不是内部或外部命令 -- 解決方法 要安裝 Pyqt5 1. 首先,開啟命令提示字元。 2. 輸入 pip3 install pyqt5 好像不能執行 ! ! 錯誤顯示 : ‘ pip3 ’ 不是內部或外部命令、可執行的程式或批...
-
課程講義 下載 11/20 1) PPT 下載 + 程式下載 http://www.mediafire.com/file/cru4py7e8pptfda/106%E5%8B%A4%E7%9B%8A2-1.rar 11/27 2) PPT 下載...
-
• 認 識 PreFix、InFix、PostFix PreFix(前序式):* + 1 2 + 3 4 InFix(中序式): (1+2)*(3+4) PostFix(後序式):1 2 + 3 4 + * 後 序式的運算 例如: 運算時由 後序式的...
沒有留言:
張貼留言