   }
 
 #if MODE_DEBUG
-  Serial.print (micros () - lastTime);
-  lastTime = micros ();
+  Serial.print(sampleLastTime);
+  Serial.print('\t');
+  Serial.print(calcLastTime);
   Serial.println ("");
 #endif
 

    lastChannelSample [i] = 0;
    triggered [i] = false;
  }
#if MODE_DEBUG
lastTime = 0;
#endif
}

void loop() {

  channelSample[0] = analogRead (A0);  // L don
  channelSample[1] = analogRead (A1);  // R don
  channelSample[2] = analogRead (A2);  // L kat
  channelSample[3] = analogRead (A3);  // R kat

#if MODE_DEBUG
  Serial.print (micros () - lastTime);
  lastTime = micros ();
  Serial.print ("\t");
#endif
  
  for (short int i = 0; i < CHANNELS; i++) {
    
    sampleCache [i].put (channelSample [i] - lastChannelSample [i]);
    

    powerCache [i].put (power [i]);
    lastChannelSample [i] = channelSample [i];
    
    if (powerCache [i].get (1) == 0) {
      triggered [i] = false;
    }

    bool isDescending = true;
    for (short int j = 0; j < POWER_CACHE_LENGTH - 1; j++){
      if (!triggered [i] && (powerCache [i].get (j - 1) > powerCache [i].get (j))) {
        isDescending = false;
        break;
      }
    }
    if (isDescending) {
      if (power [i] >= HEAVY_THRES) {
        triggered [i] = true;
        Keyboard.print (heavyKeys [i]);
      } else if (power [i] >= LIGHT_THRES) {
        triggered [i] = true;
        Keyboard.print (lightKeys [i]);
      }

#if MODE_DEBUG
    calcLastTime += micros () - lastTime;
#endif
    }
    
#if MODE_DEBUG
