 
   // if timer is ticking, blink it
   int blinkerValue = LOW;
-  if(timerValue % 2 == 0) {
+  if (timerValue % 2 == 0) {
     blinkerValue = LOW;
   } else {
     blinkerValue = HIGH;

 {_B, _A, _G, _F, _D, _C, _D, _C, 
  _A, _B, _A, _G, _F, _G, _A,
  _C, _B, _A, _G, _F, _G, _c, _A, _F,
  _C, _D, _E, _F, _E, _D, _C, _F};

// durations of the melody
const int duration[] = 
 {1, 1, 1, 2, 1, 2, 1, 2,
  1, 1, 1, 1, 2, 1, 4,
  1, 1, 1, 1, 2, 1, 2, 1, 2,
  1, 1, 1, 1, 1, 1, 1, 4};

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

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

// states
int timerValue = 0; // current timer value


// output to counter 7seg LED
void displayCounter() {
  // output only when it's not playing melody (to avoid internal timer conflict)
  if (melodyCount == 0) {
    analogWrite(COUNTER_LED, map(timerValue, 0, 5999, 0, 255)); // maps 6000 sec to 100 minutes on littleBits LED
  }
}

// output to cloudBit and play melody when timer counting is finished
void checkTimerTimeout() {
  if (timerValue == 0 && timerValuePrev == 1) {
    analogWrite(CLOUDBIT_OUT, 255);
    delay(100);
    analogWrite(CLOUDBIT_OUT, 0);
    startPlayingMelody();
  }
}

// check input from cloudBit to play melody
void checkCloudBitInput() {
  int cloudBitInput = analogRead(CLOUDBIT_IN);
  if (cloudBitInput >= ANALOG_HIGH_THRETHOLD && !isCloudBitInputHigh) {
    isCloudBitInputHigh = true;
    startPlayingMelody();
  }
  if (cloudBitInput < ANALOG_HIGH_THRETHOLD) {
    isCloudBitInputHigh = false;
