node-serialport-bindings-cpp/examples/readdata.js
2013-03-28 18:11:53 -07:00

19 lines
596 B
JavaScript

////////////////////////////////////////////////////////
// Use the cool library //
// git://github.com/voodootikigod/node-serialport.git //
// to read the serial port where arduino is sitting. //
////////////////////////////////////////////////////////
var com = require("serialport");
var serialPort = new com.SerialPort("/dev/cu.usbmodemfd121", {
baudrate: 9600,
parser: com.parsers.readline('\r\n')
});
serialPort.on('open',function() {
console.log('Port open');
});
serialPort.on('data', function(data) {
console.log(data);
});