Skip to content

Instantly share code, notes, and snippets.

@chintanp
Created February 11, 2016 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chintanp/663ac9c9db99bf49ad0b to your computer and use it in GitHub Desktop.
Save chintanp/663ac9c9db99bf49ad0b to your computer and use it in GitHub Desktop.
Trying to interact with Sendyne Current Sensor SFP101
var com = require("serialport");
var serialPort = new com.SerialPort("/dev/ttyUSB0", {
baudrate: 19200,
parser: com.parsers.raw
});
serialPort.open(function (error) {
if ( error ) {
console.log('failed to open: '+error);
} else {
console.log('open');
/*
setInterval(function() {
serialPort.write('s', function(err, results) {
if (err) console.log('err ' + err);
//console.log('results ' + results);
});
}, 1000);*/
serialPort.on('data', function(data) {
console.log('data received: ' + data);
});
/*serialPort.write('s', function(err, results) {
if (err) console.log('err ' + err);
console.log('results ' + results);
});
serialPort.on('data', function(data) {
console.log('data received: ' + data);
});
*/
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment