 const int nMeasurements = 20;
 int       measurements[nMeasurements];
 int       measureIndex = 0;
+const int STATE_SEARCH    = 0;
+const int STATE_APPROACH  = 1;
+const int STATE_FOUND     = 2;
+int       currentState = STATE_SEARCH;
 
 const bool clockwise = true;
 const bool counterClockwise = false;

}

void loop() {
  rotateStep(counterClockwise);
  pingDist = measurePingDist();
  
  measurements[measureIndex] = pingDist;
  Serial.println(arrayToString(measurements,nMeasurements));
  
  //Loop around to 0 before out of bounds:
  ++measureIndex %= nMeasurements;

  delay(100);
}

String arrayToString(int array[], int arrayLength)

    servoLeft.writeMicroseconds(1300);
    servoRight.writeMicroseconds(1300);
  }
  delay(50);
  stopMovement();
}

void stopMovement(){
  servoLeft.writeMicroseconds(1500);
  servoRight.writeMicroseconds(1500);
}

void moveForward(){
  servoLeft.writeMicroseconds(1700);
  servoRight.writeMicroseconds(1300);
}

long microsecondsToCentimeters(long microseconds) {
