-
-
Save mdobson/9000ad68c43ebeba25f5 to your computer and use it in GitHub Desktop.
Scout example
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 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