Created
December 4, 2014 19:46
-
-
Save maxfunke/31f0f5de7b62ea330fa6 to your computer and use it in GitHub Desktop.
Serialport w/ Node.js. Parses Strings (send by Arduino).
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 serialport = require("serialport"); | |
var SerialPort = serialport.SerialPort; | |
var port = "/dev/tty.usbmodem1411"; | |
var sp = new SerialPort(port, { | |
parser: serialport.parsers.readline("\n") | |
}); | |
sp.on("data", function (data) { | |
console.log(data); | |
// or do some Collection/DB stuff | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment