tuxnsk / nodejs_libmodbus

libmodbus binding for nodejs
41 stars 66 forks source link

Native Function to Slave devices #45

Open timoteo7 opened 6 years ago

timoteo7 commented 6 years ago

Hi! First, I would to thank you for your wonderful library.

Can you help with some code to Native Functions in Slave Devices ? I tried that:

var native = require('modbus').native;

var ctx = native.new_rtu('/dev/ttyACM1',38400,'N', 8 ,1 );
native.connect(ctx);
native.set_slave(ctx,1);
var rc = native.read_registers(ctx, 0, 1, tab_reg);

But it doesn't seems to work.

Can you give some help with that?

Thanks in advance,