0

Line Robot - Basic lessons - Exercises - How to be sure?

Sensors are not perfect. In the previous program it can happen that the robot stops, even if there is no obstacle. How to alleviate this problem?

Task: make sensor's reading You can rely on.

Starting with a program that stops in the front of an obstacle on line, improve it, so that it never stops by mistake when there is no obstacle. Here is the previous program:

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

	if (frontLeft() < 60)
		end();
}