Basic
Follow the black line from the start box to Home. Stop fully inside Home.

Quick Learn — the model, the instructions, the program and the challenges. The theory is in Full Lesson.
EV3 Robotics›Level 1 · Beginner›Lesson 44
Level 1 · Lesson 44 · EV3-L01-4460 minutes · Ages 7+ · Model: Minesweeping Robot
The Minesweeping Robot: a driving base with an arm out in front. A Medium Motor swings the arm left and right. On the end, a Colour Sensor looks down at the ground.
The mines are coloured beams on the floor. The robot drives forward slowly. It sweeps the sensor from side to side, and counts what it finds.
By the end of the lesson, your robot will find mines. And you will know how fast it can go before it starts to miss them.
Clearing old mines from the ground is slow, careful work. A deminer kneels down. They sweep a detector across a narrow strip of ground. They move forward a few centimetres, then sweep again. They do this for hours.

A metal detector does not see a whole field. It only sees a small patch under its ring. Everything outside that patch is hidden. It is not “probably empty”. It is just not looked at.
So the whole job is about coverage: looking at every bit of ground. Sweep slowly. Keep the ring low. And the rule that matters most: overlap every sweep with the last one. Deminers move forward about half the width of the ring each time. So every patch of ground is checked twice. The rules say they must, and the reason is maths.
The world rules ask them to clear 99.6% of an area. The work is measured in square metres a day. A good deminer does not do very many. Going faster does not mean finding fewer mines. It means looking at less ground.
Sweep too fast, and the detector still works perfectly. It still beeps at everything under the ring. But some strips of ground are never under the ring at all. And nothing tells you that you missed a strip.
A sensor that says “nothing” found nothing, or looked nowhere. You cannot tell which.
This model has no step-by-step guide. The video above is not one. Watch it to see how far the arm swings, and how low the sensor sits. Then build from your teacher’s model. You are not missing a page. There is no page.
The programs below use port letters, not motor names.
You have met a blind spot in time. On the Fencing sword in Lesson 34, a long beep made the program miss the next hit. Today the blind spot is in space. It is worse, because it leaves no clue.
The Colour Sensor looks at a spot about 1 to 2 cm across. The spot is about a centimetre below it. That is all. To the sensor, the rest of the floor is not there.
The arm sweeps that spot from side to side. It draws a line across the robot’s path. At the same time, the robot rolls forward. Put the two together, and the spot draws a zig-zag on the ground.
One full sweep, over and back, takes some time. Call it T. In that time, the robot moves forward speed × T centimetres.
In one sweep, does the robot move further than the spot is wide? Then there is a strip of floor nobody looked at.
| Moves forward each sweep | Spot width | Coverage |
|---|---|---|
| 0.5 cm | 1.5 cm | overlapping. Every patch is checked more than once. This is what deminers do |
| 1.5 cm | 1.5 cm | just touching. Perfect on paper, but one wobble opens a gap |
| 5 cm | 1.5 cm | 3.5 cm of floor missed each sweep, and the robot will say the field is clear |
This is why the robot must crawl. It is not because the sensor is slow. The sensor reads hundreds of times a second. The problem is size. A small dot can only cover a wide floor if it has time to pass over all of it.
Two things must happen at once: driving and sweeping. So this program has two stacks. This is new. Each stack starts with when program starts, and both run at the same time. Put the sweep inside the driving loop, and it stops each time the robot stops for a mine.
A mine stays red under the sensor while the robot sits on it. So we count it like this. Wait for red. Count once. Then wait for not-red before you look again.
The count is kept in a variable called mines. A variable is a box that holds a number. change mines by 1 adds one to it.
The Colour Sensor looks down at a surface and can answer three quite different questions: what colour is this?, how bright is this? and how light is the room? Choosing the wrong one is the usual reason a line-following robot refuses to work.
| Block | What it does |
|---|---|
([3 v] color :: sensors) | Reports which colour it sees, from a short list — red, blue, green, black, white and a few more. |
([3 v] reflected light intensity :: sensors) | Reports how bright the surface is, as a number from 0 (black) to 100 (white). |
<[3 v] is color [red v]? :: sensors> | Reports true or false for one particular colour. |
([3 v] ambient light intensity :: sensors) | Reports how much light is falling on the sensor, 0 to 100, with its own lamp switched off. |
The sensor does not describe a colour — it picks one from a list of eight, and that list is the whole of what it can ever say:
| Reports | Means |
|---|---|
| 0 | no colour — too far away, or too dark to call |
| 1 · 2 · 3 | black, blue, green |
| 4 · 5 · 6 | yellow, red, white |
| 7 | brown |
Anything you put under it is forced into one of those eight. There is no orange and no purple: an orange brick comes back as red or as yellow, and often as red one moment and yellow the next as the robot creeps along. Light blue and grey are the other classic pair to avoid — grey is neither black nor white, so it flips between them.
This is why colour mode is a good fit for a task you control and a bad fit for one you do not. Sorting the LEGO bricks that come in the set works, because they are made in exactly these colours. Reading a printed sheet, a coloured tile from another set, or anything pastel is asking the sensor to answer a question it does not have a word for.
Two practical points follow from how it decides. It shines its own lamp and looks at how much red, green and blue comes back, so it must be close — about half a centimetre, and no more than a centimetre. Lift it and the answer decays to 0. And because it takes those three readings before it can answer, colour mode is the slowest thing this sensor does; a robot driving quickly can pass right over a small patch without ever reporting it.
When a colour must be recognised reliably, test it. Drive the robot slowly over the real surface with color shown on the screen and watch what it actually says — including what it says at the edges between two colours, which is where the wrong answers live.
Both questions are asked of the same surface at the same moment. Watch the two answers travel across a strip of colours and then over the edge of a black line.
Watch the two read-outs over the last third of the strip. One of them changes once. The other changes the whole way across.
Over the patches, both read-outs are useful. Over the edge of the line they part company: the colour name has only two answers to give and jumps between them, while the number slides smoothly from 88 down to 8. Every value in that slide tells you how far onto the line the sensor is — which is information the name simply does not carry.
A line follower built on colour names only knows “black” or “not black”, so it can only lurch. Built on reflected light it can tell how far onto the line it has drifted, which is what makes smooth following possible.
The first two modes both switch the sensor’s own lamp on and measure what bounces back off the surface. Ambient light intensity does the opposite: the lamp goes off, and the sensor simply reports how much light is arriving from wherever — 0 in the dark, up to 100 in bright light.
| Mode | Own lamp | Measures | Points |
|---|---|---|---|
| colour | on | which of eight colours the surface is | at the surface, very close |
| reflected light | on | how much of its own light comes back | at the surface, very close |
| ambient light | off | how bright the surroundings are | wherever you want to measure |
That makes it the only one of the three that is not really about the floor. A number between 0 and 100 means very little on its own, so watch the same sensor sit through five different rooms — nothing underneath it changes at any point.
the sensor’s own lamp is off — it is measuring the room
Nothing under the sensor changed at any point in this run. Ambient light is the one mode that is not asking about the surface at all.
Those are the shape of the scale rather than exact figures, but the shape is the useful part: a lit room is nowhere near 100, and the top of the range is reserved for a light pointed straight at the sensor. Cover it with your hand and the number drops to near zero — which is the easiest way to check the sensor is doing what you think.
Point it at the ceiling and it tells you whether the room lights are on; point it forwards and a torch will spike the reading, which is a way of signalling to a robot without touching it.
Do not reach for it as a substitute for reflected light. Room light falling on a black line and on white paper is almost the same, so ambient mode can barely tell them apart — the reason reflected light works is precisely that the sensor brings its own light and measures how much of it survives.
It is also the mode most at the mercy of the room. A reading taken by a window in the morning will not match the same spot in the afternoon, so anything built on ambient light needs measuring on the day, in the place, with the lights as they will be.
Even the two lamp-on modes are affected by room lighting — a reading taken by a sunny window differs from one taken in a corner. The sensor must also sit close to the surface and at a constant height, because lifting it changes the reading even though the surface has not changed.
A program does not have to be one long column of blocks. Several stacks can run at the same time, each doing its own job — one driving, one watching a sensor, one keeping the display up to date.
Give each stack its own hat block. Every stack beginning with when program starts starts at the same instant — not one after another — and from then on they run alongside each other.
Nor is it limited to two. Below, three stacks run together: a Medium Motor turning an attachment, the status light flashing, and the drive base rolling. Watch the arrows at the top — they all begin at once, and no stack waits for any other.
when program starts :: events hat [A v] start motor [clockwise v] :: motors when program starts :: events hat forever set status light to [green v] :: display wait (0.5) seconds set status light to [red v] :: display wait (0.5) seconds end when program starts :: events hat start moving [straight: 0] :: movement
Written down they have to go one under another, because a page is a column — but that is an accident of paper. On the Brick they sit side by side, and nothing in the first stack happens before anything in the third.
Parallel stacks go wrong when two of them try to control the same thing. Use the switch below to take the wheels away from the third stack and point it at motor A, which the first stack is already driving.
the program starts — all of these begin here
stack 1 · Medium Motor
stack 2 · status light
stack 3 · drive base
Every stack is highlighted at the same moment on purpose — that is what running in parallel looks like. The switch above changes only what the third stack controls.
With one owner each, all three stacks are highlighted at the same instant and all three jobs get done. With two owners, motor A is handed contradictory orders hundreds of times a second and shivers instead of turning — and notice the second cost, which is easy to miss: the wheels now have nobody driving them. A stack that goes to fight over someone else’s motor has abandoned its own job. Nothing reports an error either way; as far as the Brick is concerned every stack is working perfectly. The same happens to a display line or a variable that two stacks both write to.
The discipline is simple: give each stack sole ownership of what it controls. One stack owns the motors, another owns the screen, another watches the sensors and tells the others what it found — which is what broadcasting is for.
Coverage is speed against sweep time. Going faster does not find fewer things. It looks at less ground.
Long before there were computers, people had exactly this problem. A shepherd counting sheep through a gate, a trader counting sacks of grain, a builder counting days — none of them can hold the number in their head while they get on with the work. So they scratched a mark on a wall, cut a notch in a stick, or wrote a number on a piece of paper. The number lived outside the person, in a place they had agreed on, and they could go back to it, read it, and change it.
Better still, once the number is written down somebody else can use it. Watch these two: one of them counts and writes, the other never sees a single animal and simply reads the wall.
Notice what never happens: Ben never asks Abby. He does not need to — the number is not in her head, it is on the wall, and the wall is there for anyone who needs it.
Neither Abby nor Ben is holding the number — the wall is. And notice what never happens: Ben does not ask Abby. He does not need to, because the count is not in her head. It is in a place they both agreed on, which is what makes it useful to more than one of them.
That is all a variable is. The robot cannot hold a number in its head either, so you give it a wall of its own, write a name at the top so everyone knows which wall is which — score, count, degree_turn — and the program can read what is on it and write something new. One part of the program writes; another part reads. Exactly Abby and Ben.
Say we are counting rotations of a motor. Before we start we write 0 on the paper. Every time the motor completes a turn we cross out what is there and write one more: 0 becomes 1, then 2, then 3. That is change — it has to read the old number to work out the new one.
set is the other thing you can do, and it is completely different: rub the whole paper out and write the number you want. It does not care what was there. Press the buttons and watch what happens to the crossings-out.
The paper starts blank, so we write 0 on it. That is what a variable is: a place to keep a number while the robot works.
| Block | What it does |
|---|---|
set [count v] to (0) | Puts a value in, replacing whatever was there. |
change [count v] by (1) | Adds to what is already there. |
(count) | Reports the current value, for use in a comparison or on the display. |
set replaces; change adds. Counting things needs change. Starting a count needs set. Both programs below have both blocks — the only difference is whether the set block is inside the loop or above it.
set before the loop
set inside it
Both programs contain both blocks. Only the position of set [count] to 0 is different.
The count on the right is not broken; it is being told to start again on every pass. Each time round the loop it is wiped back to zero and then changed by one, so the honest answer is always 1 — while the motor cheerfully turns four times. A counter stuck at 1 almost always means a set block that has slipped inside the loop.
EV3 Classroom tells you what a block does by its shape, and once you have noticed that, a whole set of questions answers itself:
So when a slot is oval, any oval fits it — and it does not matter in the least where that number came from. You can take the motor’s own A degrees counted and keep it in a variable you named degree_turn, then compare that with a number later. Pick an oval below and watch the same one drop into all three kinds of slot.
pick an oval
the same oval fits all three
Every one of those slots is oval-shaped, and A degrees counted is an oval — so it drops in. Nothing about where the number came from matters.
This is what makes a variable more than a counter. A sensor reading is true only at the instant you read it; copying it into a variable freezes it, so the robot can compare where it is now against where it was when something happened:
when program starts :: events hat [A v] reset degrees counted :: motors set [degree_turn v] to ([A v] degrees counted :: sensors) start moving [right: 30] :: movement wait until <(([A v] degrees counted :: sensors) - (degree_turn)) > (400)> stop moving :: movement
Read the condition aloud: how far the motor has gone now, minus where it was when we started, is more than 400. Both are ovals, so both can go into a subtraction, and the subtraction is an oval too — which is why it can go into a comparison. Ovals nest inside ovals as deep as you need.
A variable keeps its value after the program ends. Run the program again without setting it back and the second run begins where the first left off — the count starts at 14, the robot thinks it has already done the job. Every variable a program changes must be set to its starting value at the top.
A variable is the difference between a machine that repeats a fixed routine and one that responds to how things have gone — counting parts, tracking a score, remembering where it started.
Say this back before moving on: “Nothing found is not the same as nothing there.”
Look at your robot. How high is the Colour Sensor above the floor? On this model, that one number decides if anything works.
| Part | What it is doing here |
|---|---|
| EV3 Intelligent Brick | The body. Its screen counts the mines found. |
| Drive motor ×2 | A matching pair. Today they run slowly. That is on purpose. |
| Sweep motor | Swings the arm from side to side. Its speed sets T, the sweep time. T is half of the coverage sum. |
| Colour Sensor | Faces straight down. It must be about 1 cm above the floor. Any higher, and it sees a blur of colours. Touching the floor, and it drags. |
| The arm (not electronic) | A longer arm covers a wider strip, but sweeps more slowly. You win one thing and lose another. You can measure this one. |
Step 3 is the whole lesson, done on paper. A ruler and a stopwatch can tell you a mine will be missed. Then you can prove it on the floor.
Sensors go in ports 1, 2, 3, 4. Motors go in ports A, B, C, D. You cannot swap them. If you do, nothing warns you. The robot just will not work.
| Part | Port | Why this one |
|---|---|---|
| Left drive wheel | B | One of the pair. Two motors, one job. |
| Right drive wheel | C | The other half of the pair. |
| Sweep arm | A | Its own job, and its own stack of blocks. |
| Colour Sensor | 3 | The Colour Sensor always goes here. Every program below uses port 3. |
Check your own wiring now:
Two routes, and either is fine. USB is the reliable one and the one to fall back on when a room’s Bluetooth is busy; Bluetooth leaves the robot free to move, which some models need.
Do these in order. Naming the Brick after you go looking for it in the list is how groups end up driving each other’s robots.
EV3 until somebody changes it.EV3.The two failures, every class, every time. The Brick has gone to sleep while you were building — press the centre button to wake it. Or you have paired with the group at the next table, which is why the name matters.
The long version, including Port View and how to read the port tiles, is in the Brick & Bluetooth guide.
Use Bluetooth. This time you must. A USB cable drags behind the robot and pushes the beams out of place. Then the robot is hunting mines your own cable has moved.
Stuck? The long version, with a photo of every screen, is in the Brick & Bluetooth guide.
One change at a time, and lay out the same minefield every run. Same beams, same places, counted before you start. The question is: how many did it find, out of how many are there?
Think hard about step 2. The robot is not broken. Every sensor reading is right. Every count is right. The program has no bug. But the screen says 4, and the floor has 6. The mistake is not in anything the machine did. It is in the ground it never passed over.
Before you trust a sensor’s answer, work out how much it really looked at.

Two stacks. One sweeps for ever. The other crawls forward and counts the mines it passes over.
when program starts :: events hat forever [A v] run [clockwise v] for (120) [degrees v] at (50) % speed :: motors [A v] run [counterclockwise v] for (120) [degrees v] at (50) % speed :: motors end when program starts :: events hat set movement motors to [B v] and [C v] :: movement set [mines v] to (0) clear display :: display write (mines) at line (1) :: display start moving [straight: 0] at (15) % speed :: movement forever wait until <[3 v] is color [red v]? :: sensors> stop moving :: movement change [mines v] by (1) write (mines) at line (1) :: display play beep (76) for (0.3) seconds :: sound start moving [straight: 0] at (15) % speed :: movement wait until <not <[3 v] is color [red v]? :: sensors>> end
start moving, not move for. The robot must keep driving while the loop watches the sensor. move for would make the program wait. Then nothing would check the sensor while the robot moved.What success looks like: the arm sweeps steadily, and the robot crawls. Each time the sensor crosses a beam, it stops and beeps. It adds one on the screen and moves on. At the end, the number on the screen matches the number of beams you laid out. That last check is the real test.
If it counts one mine many times, the wait for not-red is missing. Or the robot is not getting off the beam. If it sits on a mine for ever, the start-moving block is after the wait. Move it before the wait.
Build the model before you read any further. Everything after this is about making it do something, and none of it will make much sense with nothing on the table in front of you.
Fullscreen it while you build — you can pause and scrub with the player's own controls.
Check the finished build against the picture before you switch anything on. A motor mounted the wrong way round is far easier to spot now than it is to debug later, when it looks like a program fault.
This model drives, so its challenges are run on a mat. Mats differ between branches — check you are looking at the one in your room.

WRO 2019 RoboMission Elementary — Smart Passenger Transport · official WRO game mat, 2362 × 1143 mm
The challenges name these places rather than distances, so the same challenge works on any mat:
Written for the WRO 2019 RoboMission Elementary mat. Each one is a single program run that starts in the ✕ box.
Follow the black line from the start box to Home. Stop fully inside Home.

In one program run, follow the black line to Home, then on to School.

In one run, go to Home, then School, then the Zoo. Stay on the black line all the way.

In one run, go to Home, School and the Zoo, then the Shopping Center. Stay on the black line all the way.

In one run, charge at the Battery Area first. Then go to the Shopping Center, the Cinema, and finish at Home. Stay on the black line all the way.

Work through them in order — each is harder than the last. The extra challenge comes after all three, and it is meant to make you plan before you build.
Find every mine in one lane at a crawl. Your count must match the number of mines you laid out.
Use your coverage sum to guess how many mines it will miss at double speed. Then run it three times. Check your guess.
Find the fastest drive speed that still finds every mine. Write it down with the sweep speed that goes with it.
Clear a field wider than one sweep. Plan lanes that overlap. Work out how far to move over between them. Find every mine your teacher lays out. Tell us a count you can stand by. Say truly how much of the ground you really covered.