     // Code to drive dual "H" bridges
     //
 
-    if (Charged==1)                                           // Only power motors if battery voltage is good
-    {
-      if ((millis()-leftoverload)>overloadtime)
-      {
-        switch (Leftmode)                                     // if left motor has not overloaded recently
-        {
-        case 2:                                               // left motor forward
-          analogWrite(LmotorA,0);
-          analogWrite(LmotorB,LeftPWM);
-          break;
-
-        case 1:                                               // left motor brake
-          analogWrite(LmotorA,LeftPWM);
-          analogWrite(LmotorB,LeftPWM);
-          break;
-
-        case 0:                                               // left motor reverse
-          analogWrite(LmotorA,LeftPWM);
-          analogWrite(LmotorB,0);
-          break;
+    if (Charged==1) { // Only power motors if battery voltage is good
+      if ((millis()-leftoverload)>overloadtime) {
+        switch (Leftmode) { // if left motor has not overloaded recently
+          case 2:                                               // left motor forward
+            analogWrite(LmotorA,0);
+            analogWrite(LmotorB,LeftPWM);
+            break;
+
+          case 1:                                               // left motor brake
+            analogWrite(LmotorA,LeftPWM);
+            analogWrite(LmotorB,LeftPWM);
+            break;
+
+          case 0:                                               // left motor reverse
+            analogWrite(LmotorA,LeftPWM);
+            analogWrite(LmotorB,0);
+            break;
         }
       }
-      if ((millis()-rightoverload)>overloadtime)
-      {
-        switch (Rightmode)                                    // if right motor has not overloaded recently
-        {
-        case 2:                                               // right motor forward
-          analogWrite(RmotorA,0);
-          analogWrite(RmotorB,RightPWM);
-          break;
-
-        case 1:                                               // right motor brake
-          analogWrite(RmotorA,RightPWM);
-          analogWrite(RmotorB,RightPWM);
-          break;
-
-        case 0:                                               // right motor reverse
-          analogWrite(RmotorA,RightPWM);
-          analogWrite(RmotorB,0);
-          break;
+
+      if ((millis()-rightoverload)>overloadtime) {
+        switch (Rightmode) { // if right motor has not overloaded recently
+          case 2:                                               // right motor forward
+            analogWrite(RmotorA,0);
+            analogWrite(RmotorB,RightPWM);
+            break;
+
+          case 1:                                               // right motor brake
+            analogWrite(RmotorA,RightPWM);
+            analogWrite(RmotorB,RightPWM);
+            break;
+
+          case 0:                                               // right motor reverse
+            analogWrite(RmotorA,RightPWM);
+            analogWrite(RmotorB,0);
+            break;
         }
       }
     }
-    else {                                                     
+    else {
       // Battery is flat
       // Turn off motors
       analogWrite(LmotorA,0);

    rightoverload=millis();
  }

  if ((Volts<lowvolt) && (Charged==1))                        // check condition of the battery
  {                                                           // change battery status from charged to flat

    //
    // FLAT BATTERY speed controller shuts down until battery is recharged
    //

//
// Read serial port until data has been received
//
void Serialread() {
  do {
    data=Serial.read();
  } while (data<0);
}

void I2Cmode() {
  // Your code goes here
}

void logBatteryVoltage() {
  int units = analogRead(Battery);
