   int8_t arraysize = 9; // quantity of values to find the median (sample size). Needs to be an odd number
   //declare an array to store the samples. not necessary to zero the array values here, it just makes the code clearer
   uint16_t rangevalue[] = { 
-    0, 0, 0, 0, 0, 0, 0, 0, 0              };
-
+    0, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+  float temperature = 0.0;
+    
+//  digitalWrite(TEMP_SENSOR_ENABLE, HIGH);
   digitalWrite(SENSOR_ENABLE, HIGH);
-  digitalWrite(TEMP_SENSOR_ENABLE, HIGH);
-  delay(100);
-  
-  if( tempSensorFound ) {
-    sensors.requestTemperatures(); // Send the command to get temperature
-  }
+  delay(50);
 
   while( i < arraysize )
   {								    

  pinMode(SRF_SLEEP, INPUT);                // sleep the radio
  LLAP.sleep(WAKE_INT, RISING, false);      // sleep until woken on pin 2, no pullup (low power)
  pinMode(SRF_SLEEP, OUTPUT);               // wake the radio

  // Determine if we need to send a battery voltage reading or a distance reading
  if( --batteryCountDown <= 0 ) {
    int mV = readVcc();

DallasTemperature sensors(&oneWire);

// arrays to hold device address
DeviceAddress temperatureSensor;

boolean tempSensorFound = false;
float latestTemperature = 0.0;
uint16_t lastUncompDistance = 0;

uint8_t inPin[] = { 9, 10, 11, 12, 13 };

int batteryCountDown = BATTERY_READ_INTERVAL;

