Created
June 2, 2014 18:47
-
-
Save AdamMagaluk/7bf55cb0d0454bc4c542 to your computer and use it in GitHub Desktop.
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
| 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