  // Use the serial monitor, and save the results for analysis.
  
  // Mechanically adjust the brake cables so that the motion of the servo is appropriate
+       int feedbacks[5];
        Serial.println("Calibrate brakes");
        for (int i = MinimumBrake; i < FullBrake; i += 10)
      {
        analogWrite(DiskBrake, i);
 //       int current =  analogRead(CurrentBrake);
-       delay(100);  // allow tiime for brake to respond
-       int feedback = analogRead(BrakeFB);
+       delay(95);  // allow tiime for brake to respond
+       feedbacks[0] = analogRead(BrakeFB);
+       delay(1);
+       feedbacks[1] = analogRead(BrakeFB);
+       delay(1);
+       feedbacks[2] = analogRead(BrakeFB);
+       delay(1);
+       feedbacks[3] = analogRead(BrakeFB);
+       delay(1);
+       feedbacks[4] = analogRead(BrakeFB);
+       int feedback = median_filter(feedbacks);
        // feedback signal may have glitches; use of a 5 point median filter is recommended.
        Serial.print(i); Serial.print(", ");
 //       Serial.print(current); Serial.print(", ");

  
  // Mechanically position the steering link so that servo motion half-way between extremes is straight ahead.

       Serial.println("Calibrate steering");
       for (int i = HardLeft; i < HardRight; i += 10)
     {
       analogWrite(Steer, i);
//       int current =  analogRead(CurrentBrake);
       delay(100);  // allow tiime for brake to respond
       int feedback = analogRead(SteerFB);
       // feedback signal may have glitches; use of a 5 point median filter is recommended.
       Serial.print(i); Serial.print(", ");
//       Serial.print(current); Serial.print(", ");
       Serial.println(feedback);
       delay(900);   // hold each brake position 1 second.
     }
}
/*---------------------------------------------------------------------------------------*/ 
void initialize()

//========================================================================
void BrakeWrite(int i, int Delay_ms)
{
     static int BrakeFBhistory[5];
     analogWrite(DiskBrake, i);
     for (int d = 0; d < Delay_ms; d++)
     {
       int feedback = analogRead(BrakeFB);
       BrakeFBhistory[4] = feedback;
//       int current =  analogRead(CurrentBrake);
       delay(1);
       feedback = median_filter(BrakeFBhistory);
       Serial.print(d); Serial.print(", ");
       Serial.print(i); Serial.print(", ");
       Serial.print(feedback); Serial.print(", ");
