Last active
August 29, 2015 14:02
-
-
Save AdamMagaluk/6e33dc350a11af8c6d12 to your computer and use it in GitHub Desktop.
Zetta App.js
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 zetta = require('zetta'); | |
var ArduinoScout = require('./scouts/arduino_scout'); | |
var app = zetta(); | |
app.name('I heard that!'); | |
app.load(ArduinoScout); | |
app.observe('sound', function(microphone) { | |
app.observe('lcd', function(lcd) { | |
microphone.stream('sound').read(function(value) { | |
if(value > 160){ | |
lcd.call('update','I heard that!'); | |
} | |
}); | |
app.expose(lcd); | |
}); | |
app.expose(microphone); | |
}); | |
app.listen(process.env.PORT || 3001); |
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 IHeardThatApp = module.exports = function(){ | |
this.name = 'I heard that!'; | |
} | |
IHeardThatApp.prototype.init = function(zetta) { | |
app.observe('sound', function(microphone) { | |
app.observe('lcd', function(lcd) { | |
microphone.stream('sound').read(function(value) { | |
if(value > 160){ | |
lcd.call('update','I heard that!'); | |
} | |
}); | |
app.expose(lcd); | |
}); | |
app.expose(microphone); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment