Line follower robot using PID control
Within your main loop, you assign values to the sensor[] array here:

if (sensors[i] &gt; 900)
{
  sensor[i] = 1;
}
else
{
  sensor[i] = 0;
}


and then check the values here:

if ((sensor[0] == 0) &amp;&amp; (sensor[2] == 0) &amp;&amp; (sensor[3] == 0) &amp;&amp; (sensor[4] == 0))
{
    if ((sensor[0] == 1)  &amp;&amp; (sensor[2] == 1) &amp;&amp; (sensor[3] == 1) &amp;&amp; (sensor[4] == 1))
    {
      set_motors(0, 255);
      bLine = true;
      Serial.print("black");
    }
}


If you enter the first if statement (i.e., if all of the sensor[] elements are 0), then how would you ever enter the second if statement? You need some way to update the sensor values between the two. For example:

if ((sensor[0] == 0) &amp;&amp; (sensor[2] == 0) &amp;&amp; (sensor[3] == 0) &amp;&amp; (sensor[4] == 0))
{
    delay(50); // adjust delay depending on robot speed

    // check all of the sensors again
    for (int i = 0 ; i &lt; 5; i++)
    {
        if (sensors[i] &gt; 900)
        {
            sensor[i] = 1;
        }
        else
        {
            sensor[i] = 0;
        }
    }

    if ((sensor[0] == 1)  &amp;&amp; (sensor[2] == 1) &amp;&amp; (sensor[3] == 1) &amp;&amp; (sensor[4] == 1))
    {
        set_motors(0, 255);
        bLine = true;
        Serial.print("black");
    }
}