   
 }
 
-void RequestPCInstruction()
-{
-  
-  Serial.println(inputError); //Inform PC if any inputs are invlaid
-  inputError = 0;  
-
-}
-
 void UserButton1() //Tell machine to move out of the way
 {
   
   if (userControl)
   {
-    if(requestedX != 0) requestedX = 0;
-    else requestedX = UPPERBOUND_X - 1;
-  }
-  
-}
-
-void UserButton2() //Tell machine to take another turn
-{
-
-  if (userControl)
-  {
-    requestedX = currentX;
-    userControl = false;
-  }
-   
+    if(requestedX == currentX && requestedX != 0) requestedX = 0; //Move to 0
+    else if(requestedX == 0) requestedX =  UPPERBOUND_X - 1; //Move to upperboundX - 1
+    else requestedX = currentX; //Stop moving
+  }
+  
+}
+
+void UserButton2() //Give/relinquish user control
+{
+  
+  userControl = !userControl;
+  requestedX = currentX;
+  requestedY = currentY;
+  requestedR = currentR;
+  requestedE = currentE;
+  
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////

  currentR = UPPERBOUND_R / 2;
  MoveXYR();
  AllowUserTurn(); 
  PoseForPicture();
  RequestPCInstruction();
  
}

void WaitForPCInstruction() //Loop during PC operation
{
    
  char readline[32];
  char aChar;
  int val;
  int count = 0;

  memset(&readline[0], 0, sizeof(readline));
  
  do {
    delay(10);
  } while(Serial.available() <= 0); //Will loop forever until something entered into Serial Monitor
   
  do {
    aChar = Serial.read();

    count++;
    delay(10);
  } while(count != sizeof(readline) && Serial.available() > 0);

  val = atoi(strtok(readline, DELIMITER));
  if (val == 170)
  { 
    val = atoi(strtok(NULL, DELIMITER));
    if (val < 0) requestedX = 0; 
    else if (val >= UPPERBOUND_X) rewuestedX = UPPERBOUND_X - 1;
    else requestedX = val;
    val = atoi(strtok(NULL, DELIMITER));
    if (val < 0) requestedY = 0; 
    else if (val >= UPPERBOUND_Y) rewuestedY = UPPERBOUND_Y - 1;
    else requestedY = val;
    val = atoi(strtok(NULL, DELIMITER));
    if (val < 0) requestedR = 0; 
    else if (val >= UPPERBOUND_R) requestedR = UPPERBOUND_R - 1;
    else requestedR = val;
    val = atoi(strtok(NULL, ENDCHAR));
    if (val < 0) requestedE = 0; 
    else if (val >= UPPERBOUND_E) rewuestedE = UPPERBOUND_E - 1;
    else requestedX = val;
  }
 
  memset(&readline[0], 0, sizeof(readline)); 

  Serial.println("200");
  
}

