 
   // Report how long the loop took.
   unsigned long endTime = millis();
-  unsigned long elapsedTime = endTime - startTime;
+ // unsigned long elapsedTime = endTime - startTime;
 //  Serial.print("loop elapsed time = ");
 //  Serial.println(elapsedTime);
 

  // Get the next loop start time.
  unsigned long nextTime = startTime + LOOP_TIME_MS;

  startCapturingRCState();

  unsigned long local_results[7];
  //  PrintDone();

  while (millis() < nextTime &&
         ~((RC_Done[RC_ESTP] == 1) && (RC_Done[RC_GO] == 1) && (RC_Done[RC_TURN] == 1) && (RC_Done[RC_RDR])))
    ;  //wait

  // got data;
  for (int i = 0; i < 8; i++)
    local_results[i] = RC_elapsed[i];
  //Print7(false, local_results);
  Serial.println("Processing RC data...");
  byte automate = processRC(local_results);
  if (automate == 0x01) //remember to tell Pat to fix this, was = instead of ==
  {
    Serial.println("Processing high-level data");
    processHighLevel(&Results);
  }
  //    Print7( true, local_results);

  Serial.println(nextTime);
  Serial.println("Clearing Results");
  Results.Clear();
  Results.kind = MSG_SENSOR;
  Results.angle_deg = TurnAngle_degx10() / 10;

  steer_control = pos;
}
/*---------------------------------------------------------------------------------------*/
int convertBrake(unsigned long amount){
  const int brakeRange = MAX_BRAKE_OUT - MIN_BRAKE_OUT;
  const int rcRange = MAX_RC - (MIDDLE + DEAD_ZONE);
  amount -= (MIDDLE + DEAD_ZONE);
  float operand = (float)amount / (float)rcRange;
  operand *= brakeRange;
  operand += MIN_BRAKE_OUT;
  int result = (int)operand;
  if(result > MAX_BRAKE_OUT)
  {
    result = MAX_BRAKE_OUT;
  }
//  if(amount > (MIDDLE + MIN_RC)
//    amount = MAX_BRAKE_OUT;
//  else if (amount > (MAX_RC - DEAD_ZONE))
//    amount = MIN_BRAKE_OUT;
  return result;
}
/*---------------------------------------------------------------------------------------*/
void brake (int amount)
