Make a full crossing on a white surface: stick 2 black stripes which intersect at 90°. The robot should follow a line, stop for 1 sec. on the crossing, then continue following the same stripe as before the crossing. The line-following code is here:
Solution
void RobotLine::loop() {
if (line(0) && line(8)){
stop();
delayMs(1000);
go(50, 50);
delayMs(500);
}
if (line(5))
go(10, 80);
else if (line(3))
go(80, 10);
else
go(60, 60);
}
Remember that "&&" is logical "and". Second "if" - when both edge transistors find a black stripe, the robot is entering a crossing. Stop, wait 1 second, then go on for 500 ms, not minding the stripe below. 500 ms should be enough to exit the crossing. If not, change this parameter.
Index 8 denotes the last transistor in sensor. If You have MRMS reflectance sensors 8x, CAN, analog, I2C instead of MRMS reflectance sensors 9x, CAN, analog, I2C, the last index is 7.