Skip to content

Instantly share code, notes, and snippets.

@AdamMagaluk
Created June 2, 2014 18:47
Show Gist options
  • Save AdamMagaluk/7bf55cb0d0454bc4c542 to your computer and use it in GitHub Desktop.
Save AdamMagaluk/7bf55cb0d0454bc4c542 to your computer and use it in GitHub Desktop.
var SerialPort = require('serialport').SerialPort;
var Sound = require('./sound');
var ArduinoScout = module.exports = function(){
this.portName = '/dev/tty.usbserial';
};
ArduinoScout.prototype.init = function(cb){
this.connect(this.portName, cb);
};
ArduinoScout.prototype.connect = function(portName, cb){
var self = this;
var port = new SerialPort(portName, function(err){
if(err)
return cb(err);
self.emit('discover', Sound, port);
// or
self.discover(Sound, port);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment