 #if MODE_JIRO
 #define HEAVY_THRES LONG_MAX
 #endif
+
+unsigned long int lastTime;
 
 int channelSample [CHANNELS];
 int lastChannelSample [CHANNELS];

    lastChannelSample [i] = 0;
    triggered [i] = false;
  }
}

void loop() {

#if MODE_DEBUG
  long int sampleLastTime = 0;
  long int calcLastTime = 0;
#endif
  
  for (short int i = 0; i < CHANNELS; i++) {

#if MODE_DEBUG
    long int lastTime = micros();
#endif
    
    channelSample[i] = analogRead (pins[i]);
    
#if MODE_DEBUG
    sampleLastTime += micros () - lastTime;
    lastTime = micros();
#endif
    
    sampleCache [i].put (channelSample [i] - lastChannelSample [i]);
    
    long int tempInt;

 ***************************************************************/

#define MODE_JIRO 1
#define MODE_DEBUG 0

#define CHANNELS 4

#define SAMPLE_CACHE_LENGTH 12
#define POWER_CACHE_LENGTH 3

#define LIGHT_THRES 5000
#define HEAVY_THRES 20000

#include <limits.h>
#include <Keyboard.h>
