   digitalWrite(SPEAKER_OUT, blinkerValue);
 }
 
-// output to counter 7seg LED
-void displayCounter() {
-  int counterValue = map(timerValue, 0, 5999, 0, 255); // maps 6000 sec to 100 minutes on littleBits LED
-  analogWrite(COUNTER_LED, counterValue);
-}
-
-// output to cloutBit when timer counting is finished
-void checkTimeout() {
-  if (timerValue == 0 && timerValuePrev == 1) {
-    analogWrite(CLOUDBIT_OUT, 255);
-    delay(100);
-    analogWrite(CLOUDBIT_OUT, 0);
-    melodyCount = MAX_MELODY_COUNT;
-  }
-}
-
 // play the melody if melodyCount > 0
 void playMelody() {  
   

  1, 1, 1, 1, 1, 1, 1, 4};

// total number of notes
const int NOTES_COUNT = 32;

// duration of each note
const int NOTE_DUR = 200;

int startBtnPrev = LOW; // previous start button value
int stopBtnPrev = 0; // previous stop button value
int timerValuePrev = 0; // previous timer value
boolean isCloudBitInputHigh = false; // is cloudBit input HIGH?
int melodyCount = 0; // remaining count of melody play
int noteIndex = 0; // current note index
unsigned long nextToneTime = 0; // time to play next tone
