0

Line Robot - Basic lessons - Exercises - Cross intersection

Another exercise inspired by RCJ Rescue Line.

Task: go over a crossing.

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:

void RobotLine::loop() {
	if (line(5))
		go(10, 80);
	else if (line(3))
		go(80, 10);
	else
		go(60, 60);
}