HELP i need to programme my MZ80 sensor to Avoid obstacles

Hi my Friend I need some help To improuve my program line follower I need to program my MZ80 obstacles avoider to catch the obsacle and stop before a good distance then turn left and return to the line
so this is my TrackTime function I need to add some line to make my function stop also when he detect the obstacles

#include <QTRSensors.h>
#define NUM_SENSORS             6  // number of sensors used
#define NUM_SAMPLES_PER_SENSOR  4  // average 4 analog samples per sensor reading



#define sagmotor1 9
#define sagmotor2 10 
#define solmotor1 3
#define solmotor2 11
#define MZ80 5
#define startbuton 2
void TrackTime(int BaseSpeed, float Kp, float Ki, float Kd, int Timer) {
  Last_Time =  millis();
  while (((millis() - Last_Time) <= Timer)&& (sensorValues[0] < 400 || sensorValues[5] < 400) ) {
    TrackNormal(BaseSpeed, Kp, Ki, Kd);
  }
}