Problem with Slow servo after processing sketch

Hi, currently I am trying to get a processing code to work with my robot. When it runs in autonomous mode, the robot will stop, scan, then move in a direction to avoid an obstacle. I wrote a small piece of code to link my arduino sketch to processing but now the servo turns at a really slow rate. The processing code has a screen that scans the environment similar to a radar. I’ve tried changing the delay, but it doesn’t work. Below is a portion of my code where I’m having a problem.

void loop()
{

    LookAhead();    
    //Serial.print(inches);
    //Serial.println(" inches"); // Prints a line in the serial monitor

    if(inches >= minSafeDist) /* If the inches in front of an object is greater than or equal to the minimum safe distance (11 inches), react*/
      {
            AllForward(); // All wheels forward
            delay(110); // Wait 0.11 seconds
         
       }else // If not:

{
            AllStop(); // Stop all motors
            for (int i=0; i<180; i=i+1) {
             PingServo.write(i);
            delay(50);
            ping();
            delay(50);
            Serial.print("X");
            Serial.print(i);
            Serial.print("V");
            Serial.println(inches*2); 
            }
            LookAround(); // Check your surroundings for best route


      if(rightDist > leftDist) // If the right distance is greater than the left distance , turn right
        {
              turnRight();

      }else if (leftDist > rightDist) // If the left distance is greater than the right distance , turn left
{
              turnLeft();

      }else if (leftDist&&rightDist<minSafeDist) // If the left and right distance is smaller than the min safe distance (11 inch) go back
{

               GoBack();
}
}
}

Problem area:

  AllStop(); // Stop all motors
            for (int i=0; i<180; i=i+1) {
             PingServo.write(i);
            delay(50);
            ping();
            delay(50);
            Serial.print("X");
            Serial.print(i);
            Serial.print("V");
            Serial.println(inches*2);
for (int i=0; i<180; i=i+1) {
             PingServo.write(i);
            delay(50);
            ping();
            delay(50);

let me guess; it takes about 18 seconds to do a sweep.

You need to read this

Phrases like

turns at a really slow rate.

and

it doesn’t work

may mean something to you, but without further explanation, mean nothing at all to us.

Yes, you’re absolutely right; it takes approximately 18 seconds to sweep. Thanks for pointing that out and directing me towards that post.