stream icon indicating copy to clipboard operation
stream copied to clipboard

How to read the value of the coil after writing on it

Open saadsaeed123 opened this issue 7 years ago • 0 comments

Hello,

I am using the function 'writeSingleCoil' to write value 1 on address 5. The example is given below: var modbus = require("modbus-stream"); modbus.tcp.server({ debug: "server" }, (connection) => { connection.writeSingleCoil({ address: 5, value: 1 }, (err, info) => { console.log("Write Request: Server"); console.log("response", info.response); }); }).listen(12345, () => { modbus.tcp.connect(12345, { debug: "client" }, (err, connection) => { connection.on("write-single-coil", (request, reply) => { console.log("Write Request: Client"); console.log(request.request.value); reply(null, 2,1); }); }); }); My Questions are:

  1. Is this value getting stored somewhere in the memory?
  2. Can I retrieve the the saved value?

saadsaeed123 avatar Sep 23 '19 10:09 saadsaeed123