   return round(newAverage);
 }
 
-//check whether the sensor is working.
 void sensorCheck() {
-  validAverage = measure(); //Get a first average for use in exponential moving average calculation.
+  validAverage = measure(); //Gets the first average for use in exponential moving average calculation.
   if (validAverage == 0) {
     //Sensor isn't working. Action required.
   }

    handleInvalid(distance);
  }
  
  Serial.print(distance); //blauw
  Serial.print(" ");
  Serial.print(validAverage);
  Serial.print(" ");
  Serial.print(sensor.convert_cm(distance) * 60);
  Serial.print(" ");
  Serial.print(sensor.convert_cm(validAverage) * 60);
  Serial.println();

  /*
  Serial.print(sensor.convert_cm(distance) * 10);
  Serial.print(" ");
  Serial.println(sensor.convert_cm(validAverage) * 10); 
  */

  delay(30);
}

unsigned int measure(){
  return sensor.ping();
}


/*
Program to use the HC - SR04 Ultrasonic sensor.
Smoothens measurements using an exponential moving average.


