0

Line Robot - Basic lessons - Signal sharp bending

Task: signal sharp bend.

Follow the line with 4 transistors. Each time the robot detects a sharp curve to the left or right, display "S" for 500 ms. Otherwise, display "L". The line-following code is here:

void RobotLine::loop() {
	if (line(8))
		go(-90, 90);
	else if (line(5))
		go(-30, 90);
	else if (line(3))
		go(90, -60);
	else if (line(0))
		go(90, -90);
	else
		go(60, 60);
}