Created
February 11, 2016 00:16
-
-
Save chintanp/663ac9c9db99bf49ad0b to your computer and use it in GitHub Desktop.
Trying to interact with Sendyne Current Sensor SFP101
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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