UNPKG

sclick-fins

Version:

Node.js implementation of the Omron FINS protocol

29 lines (22 loc) 761 B
var fins = require('../lib/index'); /* Connecting to remote FINS client on port 9600 with default timeout value. */ var client = fins.FinsClient(9600, '192.168.250.21'); console.log(client); /* Setting up our error listener */ client.on('error', function (error) { console.log("Error: ", error); }); /* Setting up the response listener Showing properties of a response */ client.on('reply', function (msg) { console.log("Reply from: ", msg.remotehost); console.log("Replying to issued command of: ", msg.command); console.log("Response code of: ", msg.code); console.log("Data returned: ", msg.values); }); /* Read 10 registers starting at DM register 00000 */ client.read('D6', 1, function (err, bytes) { console.log("Bytes: ", bytes); });