modbus-serial
Advanced tools
Comparing version 2.1.3 to 2.1.4
// create an empty modbus client | ||
//var ModbusRTU = require("modbus-serial"); | ||
var ModbusRTU = require("../index"); | ||
var ModbusRTU = require("modbus-serial"); | ||
var client = new ModbusRTU(); | ||
@@ -14,4 +13,4 @@ | ||
client.readInputRegisters(0, 10) | ||
.then(console.log) | ||
.then(console.lot) | ||
.then(run); | ||
} |
{ | ||
"name": "modbus-serial", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "A pure JavaScript implemetation of MODBUS-RTU (and TCP) for NodeJS.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -162,11 +162,13 @@ # modbus-serial | ||
// open connection to a serial port | ||
client.connectRTU("/dev/ttyUSB0", {baudrate: 9600}); | ||
client.setID(1); | ||
client.connectRTU("/dev/ttyUSB0", {baudrate: 9600}, run); | ||
// read 2 16bit-registers to get one 32bit number | ||
setTimeout(function() { | ||
function run() { | ||
client.setID(1); | ||
// read 2 16bit-registers to get one 32bit number | ||
client.readInputRegisters(5, 2, function(err, data) { | ||
console.log(data.buffer.readUInt32BE()); | ||
var int32 = data.buffer.readUInt32BE(); | ||
console.log(int32); | ||
}); | ||
}, 1000); | ||
} | ||
``` | ||
@@ -173,0 +175,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
468
50544
1105