Skip to content

Instantly share code, notes, and snippets.

@AdamMagaluk
Last active August 29, 2015 14:02
Show Gist options
  • Save AdamMagaluk/6e33dc350a11af8c6d12 to your computer and use it in GitHub Desktop.
Save AdamMagaluk/6e33dc350a11af8c6d12 to your computer and use it in GitHub Desktop.
Zetta App.js
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);
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