Skip to content

Instantly share code, notes, and snippets.

@mdobson
Created June 6, 2014 16:51
Show Gist options
  • Select an option

  • Save mdobson/9000ad68c43ebeba25f5 to your computer and use it in GitHub Desktop.

Select an option

Save mdobson/9000ad68c43ebeba25f5 to your computer and use it in GitHub Desktop.
Scout example
var util = require('util');
var Scout = require('zetta').Scout;
var SerialPort = require('serialport').SerialPort;
var Microphone = require('./microphone_driver');
var Arduino = module.exports = function(runtime) {
Scout.call(this);
// allow access to runtime to other methods.
this.runtime = runtime;
this.portName = '/dev/tty.usbserial';
};
util.inherits(Arduino, Scout);
// Must include init function
Arduino.prototype.init = function(cb) {
var self = this;
var port = new SerialPort(portName, function(err) {
if(err) {
return cb(err);
}
self.discover(Microphone, port);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment