         Serial.begin(9600);
 #endif
         initialize();
+        
+        CalibrateBrakes();
+        
+        CalibrateSteering();
 }	
 
 /*---------------------------------------------------------------------------------------*/ 
+void CalibrateBrakes()
+{
+  // This routine establishes the correct values for MinimumBrake and FullBrake.
+  // Verify that the value for FullBrake stops the vehicle.
+  // It allows us to establish the constants to map the feedback to the commanded position.
+  
+  // PWM signal is only effective from 127 to 255.
+  // Some of the extreme values produce no motion in an unattached servo.
+  // When the servo is atached to the brake lever, pushing too hard can draw too much power and blow a fuse.
+  
+  // Perform this test first with an unattached servo.
+  // Repeat with an attached servo.
+  
+ // It would be a good idea to put an ammeter on the brake servo to verify that excess current is not being drawn;
+ // In case current gets too high, abort by unplugging the servo.
+ 
+ // Use the serial monitor, and save the results for analysis.
+ 
+ // Mechanically adjust the brake cables so that the motion of the servo is appropriate
+       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);
+       // 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 CalibrateSteering()
+{
+  // This routine establishes the correct values for HardLeft, HardRight, Straight, etc.
+  // Verify that the values for left are those that turn the vehicle to the let.
+  // It allows us to establish the constants to map the feedback to the commanded position.
+  
+  // PWM signal is only effective from 127 to 255.
+  // Some of the extreme values produce no motion in an unattached servo.
+  // When the servo is atached to the steering link, pushing too hard can draw too much power and blow a fuse.
+  
+  // Perform this test first with an unattached servo.
+  // Repeat with an attached servo.
+  
+ // It would be a good idea to put an ammeter on the steering servo to verify that excess current is not being drawn;
+ // In case current gets too high, abort by unplugging the servo.
+  // Use the serial monitor, and save the results for analysis.
+  
+  // 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()
 {
         
         Halt();
         
-        Instrument[Motor].EnablePin = EnableMotor;
-        Instrument[Motor].SignalPin = TractionMotor;
-        Instrument[Motor].FeedbackPin = FeedbackMotor;
+        Instrument[Motor].EnablePin = EnableThrottle;
+        Instrument[Motor].SignalPin = Throttle;
+ //       Instrument[Motor].FeedbackPin = FeedbackMotor;
         Instrument[Motor].CurrentPin = Current36V;
         Instrument[Motor].StepSize = 20; // max from range of 1023.
         Instrument[Motor].CloseEnough = 1000;  // no feedback

     analogWrite(Steer, i);
     for (int d = 0; d < Delay_ms; d++)
     {
 //      int feedback = analogRead(FeedbackBrake);
 //      int current =  analogRead(CurrentBrake);
       Serial.print(d); Serial.print(", ");
       Serial.print(i); Serial.print(", ");

        
        Instrument[Brakes].EnablePin = EnableBrake;
        Instrument[Brakes].SignalPin = DiskBrake;
        Instrument[Brakes].FeedbackPin = BrakeFB;
        Instrument[Brakes].CurrentPin = CurrentBrake;
        Instrument[Brakes].StepSize = 50;
        Instrument[Brakes].CloseEnough = 1;
