 
 double c2f (double c) {
   return ((9*c)/5 + 32);
+}
+
+const int numReadings = 20;
+double tempReadings[numReadings];  //an array of analog readings
+int smoothingIndex = 0;      //index for readings
+double smoothingTotal = 0;      //the running total
+
+double smoothTemp (double newReading) {
+  smoothingTotal -= tempReadings[smoothingIndex];
+  tempReadings[smoothingIndex] = newReading;
+  smoothingTotal += tempReadings[smoothingIndex];
+  smoothingIndex ++;
+
+  if(smoothingIndex == numReadings)
+    smoothingIndex = 0;
+
+  return (smoothingTotal/numReadings);
 }
  if (currentTempRefresh - previousTempRefresh > tempInterval) {
    previousTempRefresh = currentTempRefresh;

    double tempC = (500.0 * analogRead(tempPin)) / 1204; //poll analog to read value from LM35 
    double tempF = c2f(tempC);

    splitNumber(tempF);
  }

  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
}

const long refreshInterval = 10; //refresh delay in microseconds
long previousRefresh = 0; //previous refresh time
int refreshLoop = 0;  //counter for refreshing loop

void loop() {
  //current timer variables to reset at each iteration
