 
 void loop()
 {
-  //------------------------------------------------------------ Check battery voltage and current draw of motors ---------------------
-
-  Volts=analogRead(Battery);                                  // read the battery voltage
-  LeftAmps=analogRead(LmotorC);                               // read left motor current draw
-  RightAmps=analogRead(RmotorC);                              // read right motor current draw
+  //
+  // Check battery voltage and current draw of motors
+  //
+
+  // read the battery voltage
+  Volts=analogRead(Battery);
+
+  // read left motor current draw
+  LeftAmps=analogRead(LmotorC);
+
+  // read right motor current draw
+  RightAmps=analogRead(RmotorC);
 
   //Serial.print(LeftAmps);
   //Serial.print("    ");


void RCmode()
{
  //------------------------------------------------------------ Code for RC inputs ---------------------------------------------------------
  Speed=pulseIn(RCleft,HIGH,25000);                           // read throttle/left stick
  Steer=pulseIn(RCright,HIGH,25000);                          // read steering/right stick

  if (Speed==0) Speed=1500;                                   // if pulseIn times out (25mS) then set speed to stop
  if (Steer==0) Steer=1500;                                   // if pulseIn times out (25mS) then set steer to centre

  if (abs(Speed-1500)<RCdeadband) Speed=1500;                 // if Speed input is within deadband set to 1500 (1500uS=center position for most servos)
  if (abs(Steer-1500)<RCdeadband) Steer=1500;                 // if Steer input is within deadband set to 1500 (1500uS=center position for most servos)

  if (Mix==1)                                                 // Mixes speed and steering signals
  {
    Steer=Steer-1500;
    Leftspeed=Speed-Steer;
    Rightspeed=Speed+Steer;
  }
  else                                                        // Individual stick control
  {
    Leftspeed=Speed;
    Rightspeed=Steer;
  }
  
  /*
  Serial.print("Left:");
  Serial.println(Leftspeed);
  Serial.print("Right:");
  Serial.println(Rightspeed);
  */
 
  Leftmode=2;
  Rightmode=2;
  if (Leftspeed>(Leftcenter+RCdeadband)) Leftmode=0;          // if left input is forward then set left mode to forward
  if (Rightspeed>(Rightcenter+RCdeadband)) Rightmode=0;       // if right input is forward then set right mode to forward

  LeftPWM=abs(Leftspeed-Leftcenter)*10/scale;                 // scale 1000-2000uS to 0-255
  LeftPWM=min(LeftPWM,255);                                   // set maximum limit 255

  RightPWM=abs(Rightspeed-Rightcenter)*10/scale;              // scale 1000-2000uS to 0-255
  RightPWM=min(RightPWM,255);                                 // set maximum limit 255
}


void SCmode()
{// ------------------------------------------------------------ Code for Serial Communications --------------------------------------

                                                              // FL = flush serial buffer
 
                                                              // AN = report Analog inputs 1-5
                                                              
                                                              // SV = next 7 integers will be position information for servos 0-6
 
                                                              // HB = "H" bridge data - next 4 bytes will be:
                                                              //      left  motor mode 0-2
                                                              //      left  motor PWM  0-255
                                                              //      right motor mode 0-2
                                                              //      right motor PWM  0-255
 
  if (Serial.available()>1)                                   // command available
  {
    int A=Serial.read();
    int B=Serial.read();

  Serial.print(units);
  Serial.println(" units)");
}

