sumo robot [help]

Im building an autonomous sumo robot using 6 hc-sr04 ultrasonic to scan enemy, 6 tcrt 5000 for line avoidance. 2 ultrasonics placed infront, another 2 at the back and 1 left and 1 right. Ive checked all the wiring and sensors by using codes that display serial monitor, there is no problem.

However this code i write by reffering this code only scan and attck using 2 ultrasonics infornt of the robot. Other ultrasonic give no feedback to the motors.

where should i edit this code so my robot can sense using all ultrasonic sensor?

/*------ Program for SUMO Robot using Arduino----- */
#include <NewPing.h>

NewPing sonarFL(36,37,70); // NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); 
NewPing sonarFR(30,31,70);
NewPing sonarMR(32,33,70);
NewPing sonarML(38,39,70);
NewPing sonarBR(34,35,70);
NewPing sonarBL(40,41,70);
int valueFL=0; //Front Left
int valueFR=0; //Front Right
int valueML=0; //Middle Left
int valueMR=0; //Middle Right
int valueBL=0; //Back Left
int valueBR=0; //Back Rright
int value=0;
int found=0;

int M=7;      // middle ir

/*-------linetrasor Inputs------*/
int BFL=25;      // front left linetracer
int BFR=22;      // front right linetracer
int BML=26;      // left linetracer
int BMR=23;      // right linetracer
int BBL=27;      // back left linetracer
int BBR=24;      // back right linetracer
/*-------definning Outputs motor------*/
int pwm_2=9;       // ANALOG/SPEED right motors
int dir_2=10;       // DIGITAL/DIRECTION RIGHT motors
int pwm_1=12;       // ANALOG/SPEED LEFT motors
int dir_1=13;     // DIGITAL/DIRECTION left motors

void setup()
{
  pinMode(BFL, INPUT);
  pinMode(BFR, INPUT);
  pinMode(BML, INPUT);
  pinMode(BMR, INPUT);
  pinMode(BBL, INPUT);
  pinMode(BBR, INPUT);
  pinMode(M,INPUT);
  pinMode(pwm_2, OUTPUT);
  pinMode(pwm_1, OUTPUT);
  pinMode(dir_1, OUTPUT);
  pinMode(dir_2, OUTPUT);
}

void robotstop()
{
    analogWrite(pwm_1,0);
    analogWrite(dir_1,0); 
    analogWrite(pwm_2,0);
    analogWrite(dir_2,0); 
}

void search() //scan opponent
{
  while (found==0)
  {
    analogWrite(pwm_1,150);
    analogWrite(dir_1,250); 
    analogWrite(pwm_2,150);
    analogWrite(dir_2,0);  
    valueFL=sonarFL.ping_cm(); 
    valueFR=sonarFR.ping_cm(); 
    valueML=sonarML.ping_cm();
    valueMR=sonarMR.ping_cm();
    valueBR=sonarBR.ping_cm();
    valueBL=sonarBL.ping_cm();
    delay(50);
    
   if ((valueFL>0)||(valueFR>0))
    {
    robotstop();
    delay(10);
    found=1;
    
       if(valueMR>0)//TURN RIGHT 90
      {
         value=valueMR-(valueFL-valueFR);
           analogWrite(pwm_1,220+value);
           analogWrite(dir_1,250);
           analogWrite(pwm_2,220);
           analogWrite(dir_2,0);
           delay(300); 
           robotstop();
           delay(10);
           found=1;  
      }  
      if(valueBR>0)//TURN RIGHT 180
      {
         value=valueMR-(valueFL-valueFR);
           analogWrite(pwm_1,220+value);
           analogWrite(dir_1,250); 
           analogWrite(pwm_2,220);
           analogWrite(dir_2,0); 
           delay(800); 
           robotstop();
           delay(10);
           found=1;  
      }  
      if(valueBL>0)//TURN LEFT 180
      {
         value=valueMR-(valueFL-valueFR);
           analogWrite(pwm_1,220);
           analogWrite(dir_1,0); 
           analogWrite(pwm_2,220-value);
           analogWrite(dir_2,250); 
           delay(800); 
           robotstop();
           delay(10);
           found=1;  
      }  
      if(valueML>0)//TURN LEFT 90
      {
         value=valueMR-(valueFL-valueFR);
           analogWrite(pwm_1,220);
           analogWrite(dir_1,0); 
           analogWrite(pwm_2,220-value);
           analogWrite(dir_2,250); 
           delay(300); 
           robotstop();
           delay(10);
           found=1;  
      }  
   }
   BFL=digitalRead(25);
   BFR=digitalRead(22);
   BML=digitalRead(26);
   BMR=digitalRead(23);
   BBL=digitalRead(27);
   BBR=digitalRead(24);
   if ((BFL==LOW)||
       (BFR==LOW)||
       (BML==LOW)||
       (BMR==LOW)||
       (BBL==LOW)||
       (BBR==LOW) )//if any sensor sense white line
    {
      robotstop();
      delay(10);
      found=1;
    }
  }
}

void charge()//attack
{
  valueFL=sonarFL.ping_cm(); //double check opponent
  valueFR=sonarFR.ping_cm(); 
  valueML=sonarML.ping_cm();
  valueMR=sonarMR.ping_cm();
  valueBR=sonarBR.ping_cm();
  valueBL=sonarBL.ping_cm();
  delay(100);
  if ((valueFL>0)||digitalRead(M)||(valueFR>0))
  {
        value=valueFL-valueFR;
        if (value<0)
        {
        analogWrite(pwm_1,220);
        analogWrite(dir_1,250); 
        analogWrite(pwm_2,220-value);
        analogWrite(dir_2,250); 
        }
        else
        {
        analogWrite(pwm_1,220+value);
        analogWrite(dir_1,250); 
        analogWrite(pwm_2,220);
        analogWrite(dir_2,250); 
         }
        delay(10);
        found=1;  
     }
    else 
    {
         found=0; 
    }
}

void nowhiteline() //all black
{
   BFL=digitalRead(25);
   BFR=digitalRead(22);
   BML=digitalRead(26);
   BMR=digitalRead(23);
   BBL=digitalRead(27);
   BBR=digitalRead(24);
  if(digitalRead(BFL==HIGH)||
     digitalRead(BFR==HIGH)||
     digitalRead(BML==HIGH)||
     digitalRead(BMR==HIGH)||
     digitalRead(BBL==HIGH)||
     digitalRead(BBR==HIGH))
   {
    if (found==0)
    {
      search();
    }
    else
    {
      charge();
    }
   }
  else if ((BFL==LOW) || (BFR==LOW))//FL+FR=white, reverse
  {
    analogWrite(pwm_1, 250);
    analogWrite(dir_1, 0);
    analogWrite(pwm_2, 250);
    analogWrite(dir_2, 0);
    delay (800);
    analogWrite(pwm_1, 250);
    analogWrite(dir_1, 250);
    analogWrite(pwm_2, 250);
    analogWrite(dir_2, 0);
    delay(2000);
    robotstop();  
  }
  else if ((BFL==LOW))//FL=white, turn right
  {
    analogWrite(pwm_1, 250);
    analogWrite(dir_1, 0);
    analogWrite(pwm_2, 250);
    analogWrite(dir_2, 0);
    delay (800);
    analogWrite(pwm_1, 250);
    analogWrite(dir_1, 250);
    analogWrite(pwm_2, 250);
    analogWrite(dir_2, 0);
    delay(1000);
    robotstop();
  }
   else if ((BFR==LOW))//FR=white, turn left
  {
    analogWrite(pwm_1, 250);
    analogWrite(dir_1, 0);
    analogWrite(pwm_2, 250);
    analogWrite(dir_2, 0);
    delay (800);
    analogWrite(pwm_1, 250);
    analogWrite(dir_1, 0);
    analogWrite(pwm_2, 255);
    analogWrite(dir_2, 250);
    delay(1000);
    robotstop();
  }
  else if ((BBL==LOW))//BBL=white, turn right
  {
    analogWrite(pwm_1, 250);
    analogWrite(dir_1, 250);
    analogWrite(pwm_2, 255);
    analogWrite(dir_2, 0);
    delay(500);
    robotstop();
  }
  else if ((BBR==LOW))//BBR=white, turn left
  {
    analogWrite(pwm_1, 250);
    analogWrite(dir_1, 0);
    analogWrite(pwm_2, 255);
    analogWrite(dir_2, 250);
    delay(1000);
    robotstop();
  }
   else if ((BFL==LOW)||(BML==LOW))//FL+ML=white, turn right
  {
    analogWrite(pwm_1, 250);
    analogWrite(dir_1, 250);
    analogWrite(pwm_2, 255);
    analogWrite(dir_2, 0);
    delay(1000);
    robotstop();
  }
  else if ((BFR==LOW)||(BMR==LOW))//FR+MR=white, turn left
  {
    analogWrite(pwm_1, 250);
    analogWrite(dir_1, 0);
    analogWrite(pwm_2, 255);
    analogWrite(dir_2, 250);
    delay(1000);
    analogWrite(pwm_1,0);
    analogWrite(dir_1,250); 
    analogWrite(pwm_2,250);
    analogWrite(dir_2,0);
    delay(500);
    robotstop();
  }
  else if ((BMR==LOW)||(BBR==LOW))//BMR+BBR=white, turn left
  {
    analogWrite(pwm_1, 250);
    analogWrite(dir_1, 0);
    analogWrite(pwm_2, 255);
    analogWrite(dir_2, 250);
    delay(1000);
    robotstop();
  }
  else if ((BBL==LOW)||(BML==LOW))//BBL+BML=white, turn RIGHT
  {
    analogWrite(pwm_1, 250);
    analogWrite(dir_1, 250);
    analogWrite(pwm_2, 255);
    analogWrite(dir_2, 0);
    delay(1000);
    robotstop();
  }
  
}

void loop() 
{
  nowhiteline();
}

What do your serial print statements tell you is happening?

You REALLY need to get rid of the delay()s. You wouldn't try to drive a car with a blindfold on, peeking out only now and then, would you? Why is your sumo robot fighting blind?

PaulS:
What do your serial print statements tell you is happening?

using newping library code example all ultrasonics shows distances of each ultrasonics means its working. And using tcrt5000 simple code shows 1 , 0 also means the sensors are working..

PaulS:
You REALLY need to get rid of the delay()s. You wouldn't try to drive a car with a blindfold on, peeking out only now and then, would you? Why is your sumo robot fighting blind?

do you mean delay()s after each sensors readings?

What the various example sketches do, and what that sketch does, may not be the same thing. Why do you assume that they are?

do you mean delay()s after each sensors readings?

EVERY delay(). Every delay() means that the robot is closing it's eyes and ears and running blind. That is NOT the way to win.

PaulS:
EVERY delay(). Every delay() means that the robot is closing it's eyes and ears and running blind.

without delay how to make the motors moves with timing and change polarity/speed afterwards? any suggestion ? Thanks

without delay how to make the motors moves with timing

What timing? How does "attack" rely on timing?

How do YOU walk down the street without running into things? CONTINUOUS reading from your sensors is is the answer. Why would you program a robot to operate ANY differently?