0

Line Robot - Basic lessons - Exercises - Marker at intersection

A very useful exercise for RCJ Rescue Line.

Task: if marker detected, turn.

Follow line. If there is a left marker before the intersection, turn left. The same for right. If none, go straight. As usual, start based on line-following code:

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