mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-26 02:47:17 +00:00
19 lines
596 B
JavaScript
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);
|
|
});
|