Stop the robot after the third line

From wikiluntti
Revision as of 22:43, 5 September 2020 by Mol (talk | contribs)

Introduction

How to stop the robot after passing the third (or nth) line? This problem is very often encountered in FIRST Lego League (FLL) or in Rescue competitions. The problem is that the sensor reads continous data, and simple solution wont work.

This page gives to different solutions: (i) using timer or rotation angle to pass the lines and (ii) using flip-flop algorithm to count the black lines.


Robot

Almost any robot will do. We use Asimov 2/ Verne robot.

Sensors

One color sensor is needed.

Example Videos

Theory

Readings of the color sensor

The calibrated color sensor reads about 100 at white, and while passing the black line it reads about 0.

Using the timer/ rotation angle

By using the timer we can drive past the black line, and again look for the next black line. After finding the third one, we stop. This can be done in a loop, also. Usually, if you need to repeat the code, use a loop.


Using flip flop circuit

Example Code

Using the timer

Using flip flop circuit

Exercises

This course is supported by Meet and Code. The course is made in collaboration with Robotiikka- ja tiedekasvatus ry.

Back to Meet and Code 2020 I: Ev3-G front page