Hi there, i have an example of modbus-serial and i installed it via npm install modbus-serial
and i got an example but this example has some error which i am not getting it how to solve so can anyone check what is the issue and why the error are coming.
var modbus = require('modbus-serial');
var client = new modbus.client.RTU(
'/dev/ttyUSB0', // Replace this with the path to your serial port
{
baudRate: 9600,
dataBits: 8,
stopBits: 1,
parity: 'even'
}
);
client.writeHoldingRegisters(40010, [1]) // Write the value 1 to address 40010
.then(function() {
console.log('Success');
})
.catch(function(err) {
console.error(err);
});