When I add something after set-motors(0,0)
such as
if (sensorValue= analogRead(A5) < 500)
{
set_motors(0, 0);
Serial.println(sensorValue);
}
So, analogRead() is called to read the value of A5. That value is compared to 500. The result of that comparison, true or false, is assigned to sensorValue. If the value read from the analog pin is greater than 500, the block will be skipped, and nothing will be printed. Is that what you want? Printing true or false seems silly, to me.
Operator precedence rules need to be studied, or parentheses need to be added to override them.