Created
February 3, 2016 08:48
-
-
Save Casear/521bcc65ff24fded53a5 to your computer and use it in GitHub Desktop.
Serial example
This file contains hidden or 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
console.log('start') | |
var SerialPort = require("serialport").SerialPort | |
console.log('new') | |
var serialPort = new SerialPort("/dev/ttyS0", { | |
baudrate: 9600 | |
}); | |
serialPort.on("open", function () { | |
console.log('open'); | |
serialPort.on('data', function(data) { | |
console.log('data received: ' + data); | |
}); | |
serialPort.write("M105\n", function(err, results) { | |
console.log('err ' + err); | |
console.log('results ' + results); | |
}); | |
}); | |
console.log('123') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment