Node-Red Serial Out Control 4Port Relay
https://www.ruten.com.tw/item/show?21904711229817
316201"C倉庫"Modbus RTU 4路繼電器模組12V 四路開關量輸入 光耦隔離 RS485 W8.19012
Relay 1 on
|
var b =
Buffer.from([0x01,0x05,0x00,0x00,0xff,0x00,0x8c,0x3a]);
msg.payload=b;
return msg;
|
Relay 2 off
|
var b =
Buffer.from([0x01,0x05,0x00,0x01,0x00,0x00,0x9c,0x0a]);
msg.payload=b;
return msg;
|
Relay 2 on
|
var b =
Buffer.from([0x01,0x05,0x00,0x01,0xff,0x00,0xdd,0xfa]);
msg.payload=b;
return msg;
|
Relay 3 off
|
var b =
Buffer.from([0x01,0x05,0x00,0x02,0x00,0x00,0x6c,0x0a]);
msg.payload=b;
return msg;
|
Relay 3 on
|
var b =
Buffer.from([0x01,0x05,0x00,0x02,0xff,0x00,0x2d,0xfa]);
msg.payload=b;
return msg;
|
Relay 4 off
|
var b =
Buffer.from([0x01,0x05,0x00,0x03,0x00,0x00,0x3d,0xca]);
msg.payload=b;
return msg;
|
Relay 4 on
|
var b =
Buffer.from([0x01,0x05,0x00,0x03,0xff,0x00,0x7c,0x3a]);
msg.payload=b;
return msg;
|
[{"id":"889e5d50d80fa1b4","type":"inject","z":"6437318dfa23752d","name":"RELAY1 OFF","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":110,"y":120,"wires":[["e118006e6807f3fb"]]},{"id":"e118006e6807f3fb","type":"function","z":"6437318dfa23752d","name":"","func":"var b = Buffer.from([0x01,0x05,0x00,0x00,0x00,0x00,0xcd,0xca]);\nmsg.payload=b;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":120,"wires":[["5e62d3ca80b76b24"]]},{"id":"110f737d3fbedbbf","type":"inject","z":"6437318dfa23752d","name":"RELAY1 ON","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":110,"y":200,"wires":[["15b635b1be5f75a3"]]},{"id":"15b635b1be5f75a3","type":"function","z":"6437318dfa23752d","name":"","func":"var b = Buffer.from([0x01,0x05,0x00,0x00,0xff,0x00,0x8c,0x3a]);\nmsg.payload=b;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":200,"wires":[["5e62d3ca80b76b24"]]},{"id":"c771e364d8c589ce","type":"serial out","z":"6437318dfa23752d","name":"","serial":"00b7cdd2c943b859","x":630,"y":440,"wires":[]},{"id":"5e62d3ca80b76b24","type":"link out","z":"6437318dfa23752d","name":"","links":["61e555864a34e82b"],"x":395,"y":160,"wires":[]},{"id":"61e555864a34e82b","type":"link in","z":"6437318dfa23752d","name":"","links":["5e62d3ca80b76b24","4055fdde8ccd3a83","b0be2215ee0aa9b2","84724517a4bfcac7"],"x":515,"y":460,"wires":[["c771e364d8c589ce"]]},{"id":"cb2be1a359105551","type":"ui_button","z":"6437318dfa23752d","name":"","group":"4d31fa9f1aa9c56f","order":0,"width":0,"height":0,"passthru":false,"label":"RELAY1 OFF","tooltip":"","color":"Black","bgcolor":"#00FF00","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":100,"y":160,"wires":[["e118006e6807f3fb"]]},{"id":"6726d9ad382b7879","type":"ui_button","z":"6437318dfa23752d","name":"","group":"4d31fa9f1aa9c56f","order":0,"width":0,"height":0,"passthru":false,"label":"RELAY1 ON","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":90,"y":240,"wires":[["15b635b1be5f75a3"]]},{"id":"9e7ec1f87155779f","type":"inject","z":"6437318dfa23752d","name":"RELAY2 OFF","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":110,"y":300,"wires":[["5ddf8f2b9717a191"]]},{"id":"5ddf8f2b9717a191","type":"function","z":"6437318dfa23752d","name":"","func":"var b = Buffer.from([0x01,0x05,0x00,0x01,0x00,0x00,0x9c,0x0a]);\nmsg.payload=b;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":300,"wires":[["4055fdde8ccd3a83"]]},{"id":"b5f9c42303288eed","type":"inject","z":"6437318dfa23752d","name":"RELAY2 ON","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":110,"y":380,"wires":[["4c64d9d87fb2a532"]]},{"id":"4c64d9d87fb2a532","type":"function","z":"6437318dfa23752d","name":"","func":"var b = Buffer.from([0x01,0x05,0x00,0x01,0xff,0x00,0xdd,0xfa]);\nmsg.payload=b;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":380,"wires":[["4055fdde8ccd3a83"]]},{"id":"4055fdde8ccd3a83","type":"link out","z":"6437318dfa23752d","name":"","links":["61e555864a34e82b"],"x":395,"y":340,"wires":[]},{"id":"3a8245f0525cb21f","type":"ui_button","z":"6437318dfa23752d","name":"","group":"4d31fa9f1aa9c56f","order":0,"width":0,"height":0,"passthru":false,"label":"RELAY2 OFF","tooltip":"","color":"black","bgcolor":"#00FF00","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":100,"y":340,"wires":[["5ddf8f2b9717a191"]]},{"id":"7ba22dc64b6525c0","type":"ui_button","z":"6437318dfa23752d","name":"","group":"4d31fa9f1aa9c56f","order":0,"width":0,"height":0,"passthru":false,"label":"RELAY2 ON","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":90,"y":420,"wires":[["4c64d9d87fb2a532"]]},{"id":"4087525b30dd8695","type":"inject","z":"6437318dfa23752d","name":"RELAY3 OFF","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":110,"y":480,"wires":[["4bd095ebc2d808d7"]]},{"id":"4bd095ebc2d808d7","type":"function","z":"6437318dfa23752d","name":"","func":"var b = Buffer.from([0x01,0x05,0x00,0x02,0x00,0x00,0x6c,0x0a]);\nmsg.payload=b;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":480,"wires":[["b0be2215ee0aa9b2"]]},{"id":"8b1e69dcf885b7c7","type":"inject","z":"6437318dfa23752d","name":"RELAY3 ON","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":110,"y":560,"wires":[["b4295f64048c0fba"]]},{"id":"b4295f64048c0fba","type":"function","z":"6437318dfa23752d","name":"","func":"var b = Buffer.from([0x01,0x05,0x00,0x02,0xff,0x00,0x2d,0xfa]);\nmsg.payload=b;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":560,"wires":[["b0be2215ee0aa9b2"]]},{"id":"b0be2215ee0aa9b2","type":"link out","z":"6437318dfa23752d","name":"","links":["61e555864a34e82b"],"x":415,"y":520,"wires":[]},{"id":"79289a6ce82edb92","type":"ui_button","z":"6437318dfa23752d","name":"","group":"4d31fa9f1aa9c56f","order":0,"width":0,"height":0,"passthru":false,"label":"RELAY3 OFF","tooltip":"","color":"black","bgcolor":"#00FF00","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":100,"y":520,"wires":[["4bd095ebc2d808d7"]]},{"id":"071763efb50ae293","type":"ui_button","z":"6437318dfa23752d","name":"","group":"4d31fa9f1aa9c56f","order":0,"width":0,"height":0,"passthru":false,"label":"RELAY3 ON","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":90,"y":600,"wires":[["b4295f64048c0fba"]]},{"id":"37e61a973fbd5d5f","type":"inject","z":"6437318dfa23752d","name":"RELAY4 OFF","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":110,"y":660,"wires":[["d0d359bd671eaf5a"]]},{"id":"d0d359bd671eaf5a","type":"function","z":"6437318dfa23752d","name":"","func":"var b = Buffer.from([0x01,0x05,0x00,0x03,0x00,0x00,0x3d,0xca]);\nmsg.payload=b;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":660,"wires":[["84724517a4bfcac7"]]},{"id":"ccfe61ba9953c120","type":"inject","z":"6437318dfa23752d","name":"RELAY4 ON","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":110,"y":740,"wires":[["2f04b86d5c14777f"]]},{"id":"2f04b86d5c14777f","type":"function","z":"6437318dfa23752d","name":"","func":"var b = Buffer.from([0x01,0x05,0x00,0x03,0xff,0x00,0x7c,0x3a]);\nmsg.payload=b;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":740,"wires":[["84724517a4bfcac7"]]},{"id":"84724517a4bfcac7","type":"link out","z":"6437318dfa23752d","name":"","links":["61e555864a34e82b"],"x":415,"y":700,"wires":[]},{"id":"bac915c1044c778f","type":"ui_button","z":"6437318dfa23752d","name":"","group":"4d31fa9f1aa9c56f","order":0,"width":0,"height":0,"passthru":false,"label":"RELAY4 OFF","tooltip":"","color":"black","bgcolor":"#00FF00","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":100,"y":700,"wires":[["d0d359bd671eaf5a"]]},{"id":"309e8f1b01b54e87","type":"ui_button","z":"6437318dfa23752d","name":"","group":"4d31fa9f1aa9c56f","order":0,"width":0,"height":0,"passthru":false,"label":"RELAY4 ON","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":90,"y":780,"wires":[["2f04b86d5c14777f"]]},{"id":"00b7cdd2c943b859","type":"serial-port","serialport":"COM8","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"\\n","bin":"bin","out":"char","addchar":"","responsetimeout":"10000"},{"id":"4d31fa9f1aa9c56f","type":"ui_group","name":"控制按鈕","tab":"64162787c96cc80b","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"64162787c96cc80b","type":"ui_tab","name":"4Port RELAY","icon":"dashboard","order":28,"disabled":false,"hidden":false}]
沒有留言:
張貼留言