My functions do not operate in order, why?

Hello, I am having an issue with my code. I have a mobile robot and a webcam to search for an object, the robot centers itself to the object and moves forward to some amount. However, what the codes does is run the functions pan() and move(), at the same time. I would like it to run the pan() for some amount than move() for some other amount. I am not sure where to begin, I've read a few on the millis() and tried it out but it still didn't help. Any help would be appreciated. I posted my loop to show where I would like this to happen.

void loop()
{
   readNextByte();
     
//============================================================================
// Servo/Motor Control Algorithms
//============================================================================
// Print back parsed data

    if(count == 3)
    {     
       for (int i = 0; i < 3; i++)
       {
          Serial.print(command[i]);Serial.print(var[i]);Serial.print(' ');
       }
              
// Pan servo algorithm
    
       pan(); 
       move();
   }

}

Maybe use your pan function then a delay(1000); and then goto move();

// Pan servo algorithm

pan();
delay(1000); // delay 1 second
move();

or use the do while loop until a condition is met.

Hope that helps

I've also tried to delay but the robot functions very slow. Any delay I add only slows down the robot, plus anything in my function.

Ok does it run correctly without delay();

and say get rid of move();

If I do remove the "move();" and the delay. The robot will pan correctly.

not the prettiest but try that maybe?

if(x != 5)
{
pan();
x++
}

I tried your method but it still runs both functions, now it moves forward and tries to pan at the same time.

However, what the codes does is run the functions pan() and move(), at the same time.

No, it doesn't. The Arduino can only do one thing at a time. If pan() starts some motor(s) turning, and then ends, and move() starts some motor(s) turning, and then ends, it will appear that both things are happening at the same time, but they did not.

Without seeing your pan() and move() functions, we're just guessing at how to help you.