The Dragon Boat: a long boat with a dragon’s head at the front. The head is an Ultrasonic Sensor. Two motors turn the paddles through gears.
Both motors are joined to the same axle. They must turn together, so this boat cannot steer at all. It can only go forwards and backwards.
By the end, the boat will stay in one place in front of a wall. It moves up when it drifts back. It backs off when it gets too close. When it is in the right place, it sits still.
In the real world 5 min
Where you have seen it
Dragon boat racing is a festival sport all over the world. People race from Cairo to Perth to Vienna. There are twenty paddlers. A drummer sits at the front. One person steers at the back. The boat goes nowhere unless everybody pulls together.
Small dragon boat racing. Photo: 玄史生 / Wikimedia Commons (CC0).
Why it is built that way
The drummer is not just for fun. Twenty paddles out of time cancel each other out. If one person pulls while another rests, the boat rocks and slows. The drum keeps everyone in time. The gears on your axle do the same job. They make everything move together.
Now the part that matters today. Watch a race start. The boats must stay on the start line. The wind and water push them. And they do not stay there by stopping. The water pushes them, so the crews keep making small strokes. Forwards a bit, backwards a bit, again and again, until the race starts.
Big ships do this by themselves. A ship next to an oil rig uses dynamic positioning. Computers check where the ship is. They run small engines to push it back into place. Forward, back, sideways, all day, in big waves. It is never still, but it never goes anywhere.
What would go wrong without it
A robot that can only drive forward can get close to a wall. But if it goes too far, it has no way back. Getting there only needs one direction. Staying there needs two.
To stay in one place, you must go both ways. Otherwise you can only arrive.
The main concept — which way, and when not to bother 6 min
You want the boat to sit 20 cm from the wall. There are three cases, not two. The third one is the interesting one.
Reading
Meaning
Do
more than 25 cm
too far back
paddle forward
15 to 25 cm
close enough
nothing at all
less than 15 cm
too close
back water
if <([4 v] distance in [cm v] :: sensors) > (25)> then
move [forward v] for (0.3) [rotations v] at (30) % speed :: movement
else
if <([4 v] distance in [cm v] :: sensors) < (15)> then
move [backward v] for (0.3) [rotations v] at (30) % speed :: movement
else
stop moving :: movement
end
end
A Switch inside a Switch. The first asks “too far?” If not, the second asks “too close?” If not, do nothing.
Blocks can go inside other blocks. A Switch can go inside a Switch. Each Switch only has two answers. Put one inside another, and a program can choose between three.
The dead band, and why the boat needs one
The easy version has no middle. Forward above 20, backward below 20. Try it, and the boat never stops. It nudges forward and goes past 20. It nudges back and goes past again. This is called hunting. It goes on for ever, using up batteries and going nowhere.
The gap from 15 to 25 is a dead band. In this zone, the right thing to do is nothing. It is not lazy. It is what lets the machine settle down.
Dead band
What the boat does
none (a single line at 20)
hunts for ever. Never wrong for long, but never right either
narrow (19–21)
still jumpy. One nudge jumps right past the band
sensible (15–25)
settles and stays. Only moves when it has really drifted
huge (5–50)
settles at once, but stays in the wrong place
The band must be wider than one nudge. That is the rule. Twice as wide is safer. Say a 0.3-rotation nudge moves the boat 8 cm. Then a band of 4 cm can never hold it. Every nudge throws it out the other side. Measure your nudge before you choose your band.
Where this goes next
Next lesson, the Skiing Robot uses the distance to work out how much to do. Today you work out which way to go. That comes from which side of the target you are on. Put the two together, and you have most of a real controller. Later levels spend whole lessons on this.
ComponentControl6 min
Making a decision
Up to now a robot has been able to wait for a sensor. Deciding is different: the robot checks the sensor and does one thing or another depending on the answer — and then carries on either way.
Blocks reference
Block
What it does
if <> then
end
Runs the blocks inside only when the condition is true. Otherwise skips them.
if <> then
else
end
Runs one set of blocks when true and a different set when false.
Deciding again and again
A decision made once, at the start, is almost never what you want. Here are two robots with the identical if-else, testing the identical sensor against the identical number — one inside a loop and one not.
decision inside a loop
forever
if distance < 15 then
stop moving
else · start moving
the same decision, once
if distance < 15 then
stop moving
else · start moving
247checks · in a loop1check · once only
Nothing is close, so both robots ask «is the wall within 15 cm?», both hear no, and both take the else branch and drive.The left robot is asking again, and again, and again. The right one asked once and has finished asking.Under 15 cm. The left robot's next check says stop, so it stops. The right robot has no next check.Same condition. Same sensor. Same number. Only the loop is different.Finished. One robot is parked; the other is against the wall.
wall far
A decision is only worth as much as the last time it was made. Inside a loop, that is a few milliseconds ago.
Nothing is wrong with the right-hand program’s decision. It asked the question, got a truthful answer, and acted on it correctly. It simply never asked again, and the world moved on. Decisions belong inside a loop, so the robot keeps re-deciding as things change.
when program starts :: events hat
forever
if <([4 v] distance in [cm v] :: sensors) < (15)> then
stop moving :: movement
else
start moving [straight: 0] :: movement
end
end
Four shapes, and how to choose
Once there is more than one question, decisions can be arranged in four ways. They look nearly identical stacked up in the editor, which is exactly why they get muddled — the thing that differs is not what the blocks say, it is which routes through them exist.
One question sorts them almost completely:
Are the questions…
Use
How many bodies can run
independent — any combination can be true
separate ifs
none, some, or all
one question, two answers
if / else
exactly one
the second only matters when the first is true
nested if
one, and only via the outer
mutually exclusive cases — exactly one should win
chained if / else
exactly one, the first that matches
Separate ifs — independent questions
Each if is asked no matter what the others answered, so any number of them can fire on the same pass. That is the right shape when the conditions genuinely have nothing to do with each other.
Both questions are always asked, so one pass can turn on the lamp, the fan, both, or neither. Dark and hot are unrelated — there is no reason answering one should stop the other being asked.
forever
if <[3 v] is ambient light intensity [< v] (20) %? :: sensors> then
[A v] start motor [clockwise v] :: motors
end
if <[4 v] is distance [< v] (15) [cm v]? :: sensors> then
[D v] start motor [clockwise v] :: motors
end
end
if / else — one question, two answers
Exactly one branch runs, every time. Reach for this whenever the robot must do something either way — and in preference to two ifs testing opposite conditions, which is the same idea written twice and can drift apart.
There is no route through this that runs both boxes, and none that runs neither. That guarantee is the reason to prefer it over two opposite ifs.
Nested if — a follow-up question
Putting one if inside another means the inner question is only ever asked when the outer one is true. Use it when the second question is meaningless otherwise: there is no point asking which side an obstacle is on when there is no obstacle.
The inner question sits on the outer one's yes route, so it is only reached when something is close. If nothing is close, the robot never asks which side it is on — because there is nothing to have a side.
if <[4 v] is distance [< v] (15) [cm v]? :: sensors> then
if <([2 v] angle :: sensors) < (0)> then
start moving [right: 50] :: movement
end
end
When not to nest. If you only want “both true” and nothing happens at the outer level, an and says it in one block and reads better:
if <<[4 v] is distance [< v] (15) [cm v]? :: sensors> and <([2 v] angle :: sensors) < (0)>> then
start moving [right: 50] :: movement
end
Nesting earns its place when something happens at the outer level too, or when there is an else at each level and the two mean different things.
Chained if / else — one winner out of several
This is the shape for a list of cases where exactly one should win: colour bands, distance bands, speed ranges. EV3 Classroom has no else-if block, so you build a chain by putting the next if inside the else of the last one.
Each question is only reached down the previous one's no route. The first that matches acts, and everything below it is never even asked — which is what makes overlapping bands safe.
And here is why it matters, because this is the single commonest bug in this whole module. Three bands written as three separate ifs are each perfectly correct, and together they are wrong: a reading of 20 is under 30 and under 60 and under 90, so all three run and the last one to run is the one that sticks.
three separate ifs
if light < 30 then
stop
if light < 60 then
go slowly
if light < 90 then
go fast
chained — if / else / if
if light < 30 then
stop
else
if light < 60 then
go slowly
else
go fast
↑ the rest is inside the else — never asked
3bands matchedgo fastseparate ifs dostopchained does
Separate ifs: 3 matched, last one winsChained: first match wins, rest never asked
The sensor reads 20 — a dark surface. Both programs should stop.The three separate ifs each ask their own question. 20 is under 30, so it stops… then 20 is also under 60, so it goes slowly… then 20 is under 90 too, so it goes fast. All three ran, and the last one wins.The chained version asked the same first question, got `yes`, and stopped. The other two live inside its else, so they were never even asked.Slide the reading up to 75 and both agree again — because only one band matches. The bug only shows itself where the bands overlap, which is most of the range.Finished. Same three bands, same reading — two different answers, because one shape stops asking and the other does not.
reading 20
Separate ifs are not wrong here so much as unguarded: nothing stops a second one matching. Chaining is what makes “the first one wins” true.
The rule to carry away: if the cases are meant to be exclusive, they must be made exclusive. Chaining does it by construction. Separate ifs only work if you are careful to write non-overlapping bands yourself — light < 30, 30 to 60, 60 and over — which is more to get right and easy to break later.
Why it matters
This is the point at which a machine stops following a script and starts responding. A thermostat, an automatic door, a robot vacuum — all of them are a decision inside a loop.
ComponentSensing6 min
The Ultrasonic Sensor
The Ultrasonic Sensor measures distance. It sends out a burst of sound too high for people to hear, listens for the echo, and works out how far away the surface is from how long the echo took — exactly how a bat finds a moth, and how a submarine uses sonar.
front
side
The two round openings on the front are the point of this sensor: one sends the burst of sound out, the other listens for the echo coming back.
Blocks reference
Block
What it does
([4 v] distance in [cm v] :: sensors)
Reports how far away the nearest thing in front of the sensor is, as a number in centimetres.
wait until <([4 v] distance in [cm v] :: sensors) < (15)>
Holds the program until something comes closer than 15 cm.
A number, not a yes or no
This is the important step up from the Touch Sensor. Touch gives you true or false; the Ultrasonic gives you a number, and the deciding is left to you. Pick a threshold below and watch where the robot ends up.
when program starts
start moving straight: 0
4 wait until distance <15cm
stop moving
60cm · reading15cm · threshold
Nothing is close. The sensor reports about 60 cm and the program waits.The robot drives forward. The sensor is sending a burst of sound and timing its echo, over and over, and the number falls.The reading has dropped past the threshold. The condition is true, so the robot stops.Try another threshold. The program is identical — only that one number is different.Finished. The threshold is yours to choose — the sensor only supplies the number.
stopped
The black line on the bar is the threshold; the blue fill is the reading. The robot stops the instant the fill crosses the line.
Three different robots, and only one number is different between them. That is what having a number rather than a yes-or-no buys you: the behaviour is tuned by editing one slot, not by rebuilding the program. It also means the sensor can never tell you it is “close” — close is a decision you make about a reading.
Why it matters
Car parking sensors, automatic doors at a shopping centre, and the sensor that stops a lift door closing on somebody all work this way. Reacting before contact is what makes a machine feel safe.
If your set has an Infrared Sensor instead
The Home/Retail EV3 set (31313) ships an Infrared Sensor and a Beacon in place of the Ultrasonic and Gyro sensors. The Infrared Sensor also measures distance, so the programs in this module work with it — but it reports a rough 0–100 proximity rather than real centimetres, and it is affected by sunlight and by dark surfaces in ways the Ultrasonic is not.
IR Sensor
Beacon
The Infrared Sensor and its Beacon, from the Home set. If your kit has these, expect proximity numbers rather than centimetres — and retune any threshold accordingly.
Too far, too close, or near enough. The third one stops the hunting.
▶A loop inside a loopPutting blocks inside blocks, and reading a program from the inside out.Show meHide
ComponentControl5 min
Repeating
Machines repeat. A wiper sweeps, a conveyor runs, a ride goes round — and none of that should mean copying the same blocks over and over. A loop says “do this again” once.
Blocks reference
Block
What it does
repeat (10)
end
Runs the blocks inside a set number of times, then carries on below.
forever
end
Runs the blocks inside over and over, and never carries on below.
repeat until <>
end
Repeats until a condition becomes true — a loop with a sensor as its exit.
Forever really does mean forever
Anything placed after a forever loop will never run. Not “runs late” — never. Both programs below end with the same block: set the status light green.
repeat (3)
repeat 3
A run clockwise for 0.25rotations
set status light to green
forever
forever
A run clockwise for 0.25rotations
set status light to green
↑ this block never runs
0passes · repeat (3)0passes · forever
repeat (3): still goingforever: light never set
Both loops begin. Each pass turns the motor a quarter turn.Pass 1.Pass 2.Pass 3 — and repeat (3) has now done its three.The left program carries on to the block underneath and sets its light green. The right one has jumped back to the top of the loop, and it always will.The left program has finished. The right program has not, and will not.
starting
Both programs contain the same green-light block. Let it run as long as you like — the right-hand ring will never turn green.
The repeat loop counts its three passes, stops, and moves on to the block underneath, so its light turns green. The forever loop reaches the bottom of its own blocks and jumps straight back to the top, so the block underneath is never reached — however long you leave it. If a program seems to stop half way through, look for a forever loop above the blocks that are not happening.
Why a sensor program needs a loop at all
A program is a list, and the Brick works down it once. Every block runs, in order, and when the last one is done the program is over. That is fine for a list of instructions — drive, turn, beep, stop — because each is a thing you do once.
A sensor is not a thing you do once. Asking is 1 pressed? gives you an answer about this instant, and an instant later it may be wrong. Checking a sensor once tells you what the world was like at the moment the program started — which is almost never what you wanted to know.
So a program that has to react must ask again, and again, for as long as it is running. That is the whole job of the loop: not to repeat an action, but to keep the question being asked.
Read, decide, act — and then do it again
Wrap a sensor check and the motor it controls in a forever loop and you have built a closed-loop control system — the pattern behind every line follower, thermostat and cruise control:
Read the sensor.
Decide what that reading means.
Act on the motors.
Go back to 1 — immediately, thousands of times a minute.
It is called closed because the output feeds back round to the input: the motors move the robot, moving the robot changes what the sensor sees, and what the sensor sees changes the motors. Break the circle at any point and the robot stops responding.
when program starts :: events hat
forever
if <[1 v] is pressed? :: sensors> then
[A v] start motor [clockwise v] :: motors
else
[A v] stop motor :: motors
end
end
Read it as a sentence and it is almost too simple to need explaining: for ever, if the button is pressed run the motor, otherwise stop it. The motor now follows the button for as long as the program is running.
The same program without the loop
This is the mistake nearly everybody makes first, and it is a hard one to spot because nothing about it looks wrong:
when program starts :: events hat
if <[1 v] is pressed? :: sensors> then
[A v] start motor [clockwise v] :: motors
else
[A v] stop motor :: motors
end
The logic is perfect. The ports are right. Nothing is misspelled. And the robot will ignore the button completely — because the Brick reaches that if/else a few milliseconds after you press Run, finds the button not pressed, takes the else branch, stops the motor, runs out of blocks and ends. By the time a finger arrives, there is no program left to notice it.
with forever — a closed loop
when program starts
forever
if 1 is pressed? then
A start motor clockwise
else
A stop motor
without it — the common mistake
when program starts
if 1 is pressed? then
A start motor clockwise
else
A stop motor
↑ running — for the only time
40checks · with forever1checks · no loop
Looped: motor off, matching the buttonNo loop: motor off for ever, whatever you press
Both programs start. The button is not pressed, so both take the else branch and leave the motor off. So far they agree exactly.The right-hand program has already finished. One if/else, checked once, and there were no more blocks after it — the program ended in a few milliseconds.Press the button. The looped program comes round, checks again, sees `pressed`, and starts the motor. The finished program cannot: it is not running.Release. The looped program comes round again and stops the motor. The other one has not looked at the sensor since the instant it started.Press again, and again. Every pass round the loop is another check — that constant read, decide, act is what a closed loop IS.Finished. The looped program answered the button every time. The other answered it once, before anybody had touched it.
button released
Both programs contain exactly the same if/else. The only difference is the forever block around one of them.
Both programs contain exactly the same if/else. The counter is what gives it away: one keeps checking for as long as it runs, the other is stuck on the single check it made before anybody touched anything. A student who has seen this once stops writing it.
The tell on a real robot is a program that ends the instant you start it — the Brick returns to its menu almost immediately. If a sensor program finishes rather than waits, the loop is what is missing.
Choosing the right loop
Known number of times — repeat (n). A wiper that sweeps five times.
Until something happens — repeat until. Drive until the wall is close.
For as long as the machine is on — forever. A fan, a ride, a monitor.
Say this back before moving on: “Close enough is an answer. It is usually the right one.”
What’s in this build 4 min
Look at your boat. Follow the axle from one motor to the other. It is the most important part of this build, and it has no wires.
Part
What it is doing here
EV3 Intelligent Brick
The boat’s body. Long and low, like a real one.
Large Motor ×2 — the paddles
Both are geared to one shared axle, so they must turn together. This is the shared-axle idea from Lesson 25, the Toddle Bot. If they agree, you get twice the push. If they fight, something breaks.
Ultrasonic Sensor — the dragon’s head
Right at the front, which is just where you want it. It measures the gap the boat is trying to keep.
The shared axle and gears (no wires)
This is why the boat cannot steer. But it can push twice as hard in a straight line.
Measure your nudge before you pick your band
Put the boat on your table. Mark where the front is. Then run onemove [forward v] for (0.3) [rotations v].
Measure how far it moved. That is your nudge.
Your dead band must be at least twice that. If a nudge is 5 cm, a 10 cm band (15–25) is right. A 4 cm band will never work.
Push the boat, and check it goes straight. It cannot steer. If it wanders off, the sensor stops seeing the wall. Then it never comes back.
Ports — and the rule 4 min
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 paddle motor
B
One of the pair. Two motors, one axle, one job.
Right paddle motor
C
The other half.
Dragon’s head (Ultrasonic)
4
The Ultrasonic Sensor always goes here.
Get B and C the right way round, or the motors will fight. Here the motors share one axle. A motor turning the wrong way does not turn the boat. The two motors pull against each other through the gears. Both get stuck, and the plastic can break. The Toddle Bot in Lesson 25 showed this. Here it matters even more.
The manual puts the motors in ports A and D. The Ultrasonic Sensor goes in port 2. This lesson uses B and C for the pair, and 4 for the Ultrasonic Sensor. They use these ports everywhere else in the course. That is three cables. Move them, or change the ports in every program. If you keep port 2, remember it is usually the Gyro’s port. This model has no Gyro.
Check your own wiring now:
Paddles in B and C, head in 4.
Test both motors together at low speed first, lifted off the table. Listen. Straining or clicking means one is going the wrong way. Stop at once.
Keep cables away from the paddles. Keep them off the table too.
Point the head level at the wall, not down at the table.
Connect the Brick 4 min
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.
▶How to connect the BrickUSB and Bluetooth, step by step, with a photograph of every screen. Open it if you have not done this before — or if pairing is not working.Show meHide
USB — the reliable one
Switch the Brick on with the dark grey centre button.
Cable into the Brick’s PC port — the small square socket beside the numbered ports, not one of the numbered ones.
Other end into the computer.
Bluetooth — name it first
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.
Name your Brick. On the Brick: Settings (the spanner) → Brick Name. Type something nobody else will pick, then press the tick. Every Brick is called EV3 until somebody changes it.
Turn Bluetooth on. Settings → Bluetooth. Tick Bluetooth and Visibility. Leave iPhone/iPad/iPod unticked.
Connect from EV3 Classroom. Click the Brick icon at the top of the programming area, find your Brick by name, and click Connect.
Say yes on the Brick. It asks “Connect?” with the computer’s name — choose the tick, then accept the passkey, which is already 1234.
Where to read it. The name sits in the bar across the very top of the screen, on every screen — so you can check which Brick you are holding at any moment without going into a menu. This one is EV3VE. A Brick nobody has renamed says EV3.Step 3, and the reason step 1 exists. Three Bricks in range — read the name before you click Connect. Pairing with the wrong one is not an error: it works perfectly, on somebody else’s robot.
Step 2.Bluetooth switches the radio on; Visibility is what lets the computer find you. With Visibility off your Brick works perfectly and simply never appears in the list.Step 4. Look at the Brick. It asks whether to accept and names the computer. Choose the tick.Then the passkey, already 1234. Press the tick again and you are connected.
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 boat tries to stay in place to within a few centimetres. A cable pulls it one way, like a spring. It will stay still perfectly, but at the wrong distance. And only until somebody moves the laptop.
Confirm the connection 2 min
Check the Brick icon: connected, or not.
Two motor tiles on B and C, and an Ultrasonic tile on 4.
Slide the boat by hand, and watch tile 4. Find the spot where it reads 20. Mark it with tape. That is where the boat should end up. The tape lets you see when it works.
Now find where tile 4 reads 15 and 25, and mark those too. Now the dead band is drawn on the table.
One change at a time. The best test here is to be a nuisance. Move the wall. Push the boat. See if it gets back into place.
Close the dead band to 19 and 21. Run it. The boat hunts and never settles. Now you have seen why we need the band.
Widen it to 5 and 50. It settles at once, but stays in a bad place. Too small and too big are both wrong, in different ways.
Put 15 and 25 back, and halve the nudge to 0.15 rotations. Can you make the band 17 to 23 and still have it settle? Smaller nudges let you use a smaller band.
Move the wall slowly towards the boat. Watch it back away to stay in place. It is following the wall, and you never told it to follow.
Now move the wall quickly. The boat falls behind. How fast can the wall move before the boat cannot keep up? What holds it back, the nudge size or the speed?
Try the idea from the next lesson. Change the fixed 30% speed. Make the speed grow the further out it is. Now the boat should fix a big drift fast, and a small one gently.
Step 6 joins today’s idea to the next lesson’s. Which side of the target you are on tells you which way to go. How hard to go comes from how far away you are. A controller with both does what a real proportional controller does. You built it from an if, another if inside it, and one multiplication.
A machine that can only go forward will arrive once. A machine that can fix both ways can stay.
This is what you are building: the Dragon Boat.
Make it move 10 min
When press up button, will move forward non-stop
When press down button, will move backward non-stop
Fullscreen it while you build — you can pause and scrub with the player's own controls.
Build it 15 min
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.
The program, block by block
Motors A (left) and D (right) · Speed 50% · Sensors none
What it does
Turns the brick into a hand controller. Up drives both motors forward at 50, Down
drives both back at 50, and Centre stops them. Nothing is automatic and nothing repeats.
Worth noticing
Start moving, not run for. Each button starts the pair and leaves it running; only
the centre button ends it. A block that ran for a set time would behave quite differently.
The movement pair is set inside each stack, not once at the start. That is why any of
the three can be the first button pressed after the program starts.
Down is the same speed with a minus sign — one pair of numbers, not a second block.
Challenges 27 min
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.
Challenge 1
- When the center button is pressed, it will start to move forward until the ultrasonic sensor senses less than 10 cm, then it will sound "Okay-Dokey".
Fullscreen it while you build — you can pause and scrub with the player's own controls.
Log in to see hints.
Challenge 2
When the center button is pressed, trigger action 1.
1. It will start to move forward until the ultrasonic sensor senses less than 10 cm, then it will move backward until the ultrasonic sensor senses more than 20cm, then stop and sound "Analyze".
2. After that sound, wait 2 seconds, then it will continue to move forward and repeat action 1.
Fullscreen it while you build — you can pause and scrub with the player's own controls.
Log in to see hints.
Challenge 3
Set speed at 100%.
When the center button is pressed, trigger action 1.
1. It will start to move forward until the ultrasonic sensor senses less than 50 cm, then stop and sound "Three", then do action 2.
2. Set speed at 50%, then it will start to move forward until the ultrasonic sensor senses less than 30 cm, then stop and sound "Two", then do action 3.
3. Set speed at 10%, then it will start to move forward until the ultrasonic sensor senses less than 10 cm, then stop and sound "One".
Fullscreen it while you build — you can pause and scrub with the player's own controls.
Log in to see hints.
Extra challenge
- Use ultrasonic listen mode. When you clap your hands or do the same as the video action, the robot will move forward. If there is no more sound, then the robot will stop.
- Listen mode must use EV3 Lab Version or Pybricks MicroPython.