Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Latest commit

 

History

History
50 lines (42 loc) · 1.51 KB

README.md

File metadata and controls

50 lines (42 loc) · 1.51 KB

meteor serialport

Build Status

serialport npm module wrapped for Meteor.

Example Meteor app: meteor-app-example-arduino-serialport

To Use

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')
});

Version

2.0.6_1

License

MIT