 //  int difference = finish_time - start_time;
 //  Serial.println(difference);
   
-}
+}

  drainSense = (drainSense / 1024.0) * Vcc;

  sensor = sourceSense - drainSense;
  if (sensor == 0) {
    sensor = reading();
  }
//  Serial.println(sensor);
  
  return sensor;
}

double average (double * array, int len)
{
  long sum = 0L ;  // sum will be larger than an item, long for safety.
  for (int i = 0 ; i < len ; i++)
    sum += array[i];
  return  ((double) sum) / len ;  // average will be fractional, so float may be appropriate.
}

void setup() { 


void loop() {
//  int start_time = millis();
  for (int i = 0; i < numberOfReadings; i++) {
    double sample_reading = reading();
      myStats.add(sample_reading);
//    Code takes ~245 ms to run (100 readings per output reading). 
//    When delay = 0
      delay(0);
  }
  
