 // temp. for nominal resistance (almost always 25 C)
 #define TEMPERATURENOMINAL 25   
 // how many samples to take and average, more takes longer but is more 'smooth'
-#define NUMSAMPLES 40
+#define NUMSAMPLES 41
+#define MEDIAN 21
 // The beta coefficient of the thermistor (usually 3000-4000)
 #define BCOEFFICIENT 3950
 // the value of the 'other' resistor

  analogReference(EXTERNAL);
  digitalWrite(led2, HIGH);
}

float MeasureTemp(int pin) {
  uint8_t i;
  float average =0;

   delay(5);
  }
  // average all the samples out
  //for (i=0; i< NUMSAMPLES; i++) {
  //   average += samples[i];
  //}
  //average /= NUMSAMPLES;
  insertionSort(samples);
  average = samples[MEDIAN];
  // convert the value to resistance
  average = 1023 / average - 1;
  average = SERIESRESISTOR / average;
