Created
December 22, 2014 16:27
-
-
Save szolotykh/77db08bd2ac0a733d6a9 to your computer and use it in GitHub Desktop.
Send tone command to Lego NXT
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").SerialPort | |
var serialPort = new SerialPort("COM4", { | |
baudrate: 9600 | |
}); | |
serialPort.on("open", function () { | |
console.log('open'); | |
serialPort.on('data', function(data) { | |
console.log('Data received: ' + data); | |
}); | |
var command = new Buffer([0x06, 0x00, 0x80, 0x03, 0x0B, 0x02, 0xF4, 0x01]); | |
serialPort.write(command, function(err, results) { | |
console.log('Error ' + err); | |
console.log('results ' + results); | |
serialPort.close(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment