serialport npm module wrapped for Meteor.
Example Meteor app: meteor-app-example-arduino-serialport
meteor add fourquet:serialport
On the server:
// change the path and baudrate to match your setup
var serialPort = new SerialPort.SerialPort('/dev/tty.usbmodemfd121', {
baudrate: 9600,
parser: SerialPort.parsers.readline('\r\n')
});
serialPort.on('open', function() {
console.log('Port open');
});
Do stuff:
// receive data
serialPort.on('data', function(data) {
console.log('message ' + data);
});
// send data
var sendToSerialPort = function(message) {
serialPort.write(message);
};
For more: https://github.com/voodootikigod/node-serialport
An alternative for using serialport without this package is to use the npm package. Add npm to your project and include serialport:
var SerialPort = Meteor.npmRequire('serialport');
var serialPort = new SerialPort.SerialPort('/dev/tty.usbmodemfd121', {
baudrate: 9600,
parser: SerialPort.parsers.readline('\r\n')
});
2.0.6_1
MIT