    Serial.print(avg110);
    Serial.print(",");
    Serial.println(avg150);
+   
+   // reset the variables to 0
+   // res vars
+  reading30 = reading70 = reading110 = reading150 = 0;
+  sum30 = sum70 = sum110 = sum150 = 0;
+  avg30 = avg70 = avg110 = avg150 = 0;
 }
 
   

  Serial.begin(9600);
}

void loop() {
  // res vars
  float reading30[numReadings],reading70[numReadings],reading110[numReadings],reading150[numReadings];
  float res30[numReadings],res70[numReadings],res110[numReadings],res150[numReadings];
  float sum30, sum70, sum110, sum150;
  float avg30, avg70, avg110, avg150;
  
  //set up the pins for input
  pinMode(pin30, INPUT);


//converts the reading into a cm value representing how far away the nearest
// obj is 
//double convert(double val) {
  //double res;
  //res = (val / 147) * 2.54;
  //return res;
//}

const unsigned int numReadings = 10; // number of readings per second 

