I'm having trouble using the Modbus RTU server without any documentation, is it possible to have a simple code example on how to use this? For example, I have no idea how to set the unit Id for the server, is this even correct?:
const modbus = require('jsmodbus')
const SerialPort = require('serialport')
const options = {
baudRate: 9600
}
const socket = new SerialPort("/dev/ttyUSB0", options)
const server = new modbus.server.RTU(socket, 2)
server.on('data', function (data) {
console.log(data);
});
Hey @jaydenpung sorry for the late reply, since this is an open source project, feel free to generate a tutorial for RTU. I bet many users would like to see this.
I'm having trouble using the Modbus RTU server without any documentation, is it possible to have a simple code example on how to use this? For example, I have no idea how to set the unit Id for the server, is this even correct?: