 *  while tweet-contoller.py runs on the Linino.
 *
 *  Bubbles are triggered through following ways:
-*  1. A tweet has the hashtag #teambubble
+*  1. A tweet has the hashtag #teambubbles
 *  2. It has been 15 minutes since the last tweet
 *       (need to keep water moving)
 */

  pinMode( relay1, OUTPUT );
  pinMode( relay2, OUTPUT );

  // initialise the timer for the last bubble
  lastBubble = millis();
}

//---------------------------------------------
void loop() {
  // Read command output
  Bridge.get("tweets", tweetValue, 2);
  int tweets = atoi(tweetValue);


  delay(5000);  // wait 5 seconds before you do it again

  // startup bubble
  bubble();
}

//---------------------------------------------
void bubble() {
  // turn on status LED
  digitalWrite( greenStatusLED, HIGH );
  digitalWrite( yellowStatusLED, LOW );
  
  // trigger relay
  digitalWrite( relay1, HIGH );
  digitalWrite( relay2, HIGH );
  
  // wait to create bubbles
  delay( bubbleTime );
  
  // stop relay
  digitalWrite( relay1, LOW );
  digitalWrite( relay2, LOW );
  
  // update status LEDs
  digitalWrite( greenStatusLED, LOW);
  digitalWrite( yellowStatusLED, HIGH);
  
  // wait to throttle bubbling
  delay( bubbleThrottle );
  
  // initialise the timer for the last bubble
  lastBubble = millis();
}

int bubbleTime = 150;
int bubbleThrottle = 5000;

char tweetValue[4];    // incoming storage of tweet
int lastTweetCount = 0; // keep track of number of tweets
unsigned long lastBubble;
char tweetText[141];

boolean debugMode = true;

//---------------------------------------------
void setup() {
  Bridge.begin();    // initialise Bridge

  if(debugMode) {
  // we don't want Serial when deployed
  // it will make the microcontroller hang
  // waiting for a response
  Serial.begin(9600);
  while ( !Serial );
  }

  // set up pin modes
  pinMode( greenStatusLED, OUTPUT );
