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

  return round(newAverage);
}

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

#define INVALIDMAX 5 //number of invalid measurements before further action required.

unsigned int validAverage;

void setup() {
  Serial.begin(9600);
