﻿var five = require("johnny-five");
var Edison = require("edison-io");
var Twitter = require('twitter');
var config = require('./config');

var board = new five.Board({
  io: new Edison()
});

var twit = new Twitter({
    consumer_key: config.twitter.consumerKey,
    consumer_secret: config.twitter.consumerSecret,
    access_token_key: config.twitter.accessTokenKey,
    access_token_secret: config.twitter.accessTokenSecret
});

var ON_DURATION = 2000;

board.on("ready", function() {
  var monkey = new five.Pin("GP44");
    
    //monitor by topic
    twit.stream('filter', { track: '#tweetmonkey' }, function (stream) {
        stream.on('data', function (data) {
            console.log('Tweet received from ' + data.user.screen_name + ': "' + data.text + '"');
            monkey.high();
            setTimeout(function () { monkey.low(); }, ON_DURATION);
        });
    });

});
@@ -182,24 +182,133 @@
 ison()%0A%7D);%0A%0A
+//configure the Twitter module with our consumer and access keys%0A//obtain these by going to apps.twitter.com%0A
 var twit = n
@@ -650,16 +650,37 @@
 tor 
-by topic
+tweets by tracking a hash tag
 %0A   
@@ -789,24 +789,104 @@
 on (data) %7B%0A
+            //log the tweet to the screen so we can see it if we have a console%0A
             
@@ -988,22 +988,164 @@
     
-monkey.high();
+%0A            //take the pin high to animate the monkey%0A            monkey.high();%0A            %0A            //after some time, turn the monkey back off again
 %0A   

add comments to main app.js file