Skip to content

Instantly share code, notes, and snippets.

@Fabryz
Created August 8, 2013 17:22
Show Gist options
  • Save Fabryz/6186690 to your computer and use it in GitHub Desktop.
Save Fabryz/6186690 to your computer and use it in GitHub Desktop.
Simple Node.js script to write text on the Pi Lite
var SerialPort = require("serialport").SerialPort;
var serialPort = new SerialPort("/dev/ttyAMA0", {
baudrate: 9600
}, false);
serialPort.open(function () {
console.log('Connected to Pi Lite');
var text = "Hello World";
serialPort.write(text, function(err, results) {
if (err) {
console.log('Error: '+ err);
}
//console.log('Result: '+ results);
process.exit();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment