Challenge 1
Make the animal swim out and back to where it started. It must end on the same spot, facing the same way. You may not touch it. Mark where it starts before you run it. Then nobody can argue about the result.
Quick Learn — the model, the instructions, the program and the challenges. The theory is in Full Lesson.
EV3 Robotics›Level 2 · Intermediate›Lesson 13
Level 2 · Lesson 13 · EV3-L02-1360 minutes · Ages 8+ · Model: Plesiosaurus
The Plesiosaurus: a sea animal with a long neck and a wide body. It has four wide flippers, one at each corner. It rolls forward on hidden wheels. As it goes, the four flippers sweep as if it were swimming.
There is one motor in the whole animal. It only ever turns one way.
So where does the back and forth of the flippers come from? It is not in your program. By the end of the lesson, you will know.
Plesiosaurs lived in the sea when dinosaurs lived on land. They were not dinosaurs. They breathed air. They swam with four huge flippers, and that is rare. Almost every big swimmer today, from tuna to dolphins, swims with its tail.

A flipper does not push water back like an oar. It works like a wing under water. The animal sweeps it down and forward. The shape of the flipper turns that sweep into a push. Four flippers beat in a steady rhythm. That kept a very big animal swimming smoothly.
Look at what the animal does. Its muscles pull the flipper out and back, out and back, again and again. One out and back is called a stroke. No muscle spins. Nothing in an animal goes round and round.
The steady beat is what makes it work. What if the four flippers moved any old way? The pushes would fight each other. The animal would roll about and get nowhere. Real swimmers keep the same rhythm for hours. It uses less energy than stopping and starting.
Animals go back and forth. Motors spin. Something in the middle has to change one into the other.
A motor that only goes one way can make a part go back and forth. The parts that do this are called a linkage.
Think back to the Wipers in Level 1, Lesson 2. To sweep the wiper across and back, you used two motor blocks. One went clockwise. One went counterclockwise. The program did the reversing.
The Plesiosaurus does it the other way. The motor turns the wheels one way, all the time. A rod joins the wheel to the flipper. As the wheel goes round, the rod pushes the flipper forward, then back. That happens once for each turn of the wheel. The build does the reversing.
This is one of the most useful ideas ever. It is everywhere. A car engine uses it. So does a sewing machine needle and an oil pump. Your bike pedals use it too. Your legs go up and down, and the wheel spins. Some of these run the idea backwards.
| Job | The Wipers (Level 1, Lesson 2) | The Plesiosaurus (today) |
|---|---|---|
| What reverses the movement | The program | The linkage |
| Motor direction | Changes every sweep | Never changes |
| Blocks needed for ten strokes | A loop with two motor blocks in it | One motor block. The build repeats it for free. |
| How you change the rhythm | Change the numbers in the program | Change the speed. But the build sets the shape of the stroke. |
Need something to go back and forth again and again? You can code it, or you can build it. Building it needs fewer blocks. It also works every time.
The Medium Motor is the smaller of the two EV3 motors. It is quick and light rather than strong, which makes it the right choice for anything that has to move a part of the robot rather than the whole robot — a gate arm, a pair of jaws, a winch, a pointer.
| Block | What it does |
|---|---|
[A v] run [clockwise v] for (1) [rotations v] :: motors | Turns the motor a measured amount, then stops. One rotation is one full turn of the motor shaft. |
[A v] run [clockwise v] for (90) [degrees v] :: motors | The same idea, but in degrees — useful when a quarter or a half turn is what the mechanism needs. 360 degrees is one rotation. |
[A v] run [clockwise v] for (2) [seconds v] :: motors | Turns the motor for a length of time and then stops, whatever the shaft managed to do in it. The one measurement that always finishes. |
[A v] set speed to (50) % :: motors | Sets how fast the motor will run from now on. It does not start the motor by itself. |
[A v] start motor [clockwise v] :: motors | Starts the motor turning and moves straight on to the next block. It keeps going until something stops it. |
[A v] stop motor :: motors | Stops the motor. |
These two look similar and behave completely differently, and almost every early EV3 bug comes from picking the wrong one. Watch both run the same job, over and over.
versus
Let it loop a few times. The left dial keeps landing on the same mark; the right one leaves a new mark almost every run — that scatter is what “not repeatable” means.
The black mark is where the shaft should finish. The measured motor hits it every single run, because the program waits at that block until the motor has turned exactly that far. The timed motor is only running for a second — and a second covers a different amount depending on the battery, the friction and whatever the mechanism is carrying. Each orange dash is a run that finished somewhere it was not asked to.
If a mechanism has to end up in a particular place — a gate that must finish upright, a jaw that must close fully — use the measured block.
The dropdown at the end of the run block has a third setting, and it is the one that saves lifting mechanisms. for () seconds switches the block off a distance and onto a duration: it drives the motor for that long and then stops, whatever the shaft managed to do in the time.
That sounds strictly worse than a measured turn, and for most jobs it is. It matters because of what the measured block actually waits for. run for (90) degrees does not finish when 90 degrees’ worth of time has passed. It finishes when the shaft has turned 90 degrees — and if the mechanism runs out of travel first, the shaft never will.
Every arm, jaw and lift has a physical limit: a point where the mechanism reaches the top of its travel, or something in the build gets in the way. Push a motor into that limit and it stalls — the shaft stops turning and the motor sits there straining. The motor is fine and the program is spelled correctly. But the encoder has stopped counting, so a measured block that was told a bigger number is still waiting, and it will wait until the Brick is switched off.
Nothing after that block ever runs. Not the next motor block, not the sound, not the display, not the rest of the program. That is the whole failure, and it looks like a crash even though nothing has crashed.
when program starts :: events hat [A v] set speed to (30) % :: motors [A v] run [clockwise v] for (90) [degrees v] :: motors [A v] reset degrees counted :: motors write [HOME SET] at line (1) :: display
Watch the Brick screen, not the arm. HOME SET is the block after the motor block, so a blank screen means the program never got past it.
Compare the first two. The only difference between them is 45 and 90, the mechanism is identical, and one of them is a working program while the other locks up on the third block. Nothing in the listing distinguishes them — the end stop is a fact about the build, and the program has never heard of it.
This is the mistake almost every student makes the first time a Medium Motor lifts something. A lifting arm has a lowest position and a highest one; ask it to turn past either and the program hangs. It is worse than an ordinary bug, because the robot looks alive — the motor is still being driven, still buzzing, still hot — and the next block never comes.
The fix turns the problem into the technique. You often do not know how many degrees it is to the top of an arm’s travel — it depends on the build, and it changes the moment somebody rebuilds it. So do not measure it. Drive the arm gently into its own end stop for a couple of seconds, and then declare that position to be zero:
when program starts :: events hat [A v] set speed to (30) % :: motors [A v] run [counterclockwise v] for (2) [seconds v] :: motors [A v] reset degrees counted :: motors write [HOME SET] at line (1) :: display
Three things make that work, and all three are deliberate:
After that, use measured blocks for everything inside the travel and timed blocks whenever you are driving to a limit. The rule of thumb: if the movement ends against something solid, run for seconds.
A Medium Motor is normally plugged into port A or D, which leaves B and C free for the Large Motors that drive wheels. The letter in the block must match the port the cable is actually in — this is the single most common reason a program appears to do nothing at all.
Speed is set separately from movement. You tell the motor how fast it should go, and then you tell it to go — two blocks, in that order.
| Block | What it does |
|---|---|
[A v] set speed to (25) % :: motors | Sets the speed for this motor from now on. Nothing moves — it only changes what the next movement will do. |
[A v] run [clockwise v] for (2) [rotations v] :: motors | Now moves, at whatever speed was last set. |
when program starts :: events hat [A v] set speed to (25) % :: motors [A v] run [clockwise v] for (2) [rotations v] :: motors
Swap those two blocks round and the program still contains a speed of 25 % — it just never gets used. Both shafts below are asked for exactly 2 rotations; watch how long each one takes.
speed first — works
speed last — does nothing
Both shafts turn exactly 2 rotations. Only the time they take is different — and the right-hand program never gets the slow movement it was written to have.
The right-hand movement is over before the left is a third of the way round, because it ran at the default speed. Its set speed to () block does run — you can see it light up — but by then the movement it was meant to slow down has already happened. A speed block only ever affects the movements after it. This catches people out constantly.
A high speed is not a better program. Slow movements are gentler on the gears, easier to watch and debug, and look more like the real machine — a barrier that snaps up in a fraction of a second reads as broken rather than fast.
Say this out loud before you go on: “A pin away from the middle of a turning wheel goes back and forth. That is where the stroke comes from. It is not from my program.”
Look at your animal. It has four flippers, a long neck and wheels underneath. How many parts have a cable?
| Part | What it is doing here |
|---|---|
| EV3 Intelligent Brick | Runs the program. It is also the body of the animal. Most of the weight sits over the wheels. That stops it tipping onto its neck. |
| Medium Motor, port A | Turns the wheels. The flippers just go along. All they do comes from the wheels going round. |
| Sensors | None. It cannot see the edge of the table. Remember that before you start it. |
Push the animal slowly along the table by hand. The flippers should sweep as it rolls. Each one should do one full stroke for each turn of the wheel. Does a flipper stay still? Then its rod has come off. Fix it now. With the motor on, it will look just like a program mistake.
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.
This model drives along the table. So you might expect ports B and C, the driving pair. But it is not a driving pair. There is one motor turning one axle. It cannot steer. So port A is right. Remember why. The port depends on how many motors there are and what they do. It does not depend on whether the model moves.
| Part | Port | Why this one |
|---|---|---|
| Medium Motor (wheels and flippers) | A | One motor with its own job. B and C are for a pair that steers. One motor cannot steer. |
| Sensors | none | Ports 1–4 stay empty. |
Check your own build 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 for this one. The animal moves about. A USB cable will stop it short or pull it off course. That looks like a build mistake, but it is not.
Make one change at a time. Guess what will happen before each run. Watch the flippers, not the body. The body only goes in a straight line.
Step 5 is the big idea. It is the same idea as the Apache in the last lesson. The program cannot change what the linkage decides.
The program decides the speed and the direction. The build decides the shape of the movement.

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.
One page at a time — use Next and Previous, or the ← → keys. Fullscreen makes it big enough to build from.
The same build on Google Drive — sometimes a video, sometimes a scan:
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.
Five blocks. It is the shortest program in a long time. That is the point of the lesson.
when program starts :: events hat play sound [Animals / T-rex roar v] until done :: sound [A v] set speed to (40) % :: motors [A v] run [clockwise v] for (5) [rotations v] :: motors play sound [Communication / Goodbye v] until done :: sound
Go through it in the order the Brick runs it:
Count the blocks that talk about a flipper. There are none. Four flippers keep a steady beat. Your program does not know they are there. It all comes from the pin away from the middle of the wheel.
What a good run looks like: the animal swims forward in a straight line. All four flippers sweep in a steady beat. It stops by itself. Does it curve? Then one side is dragging. Check the cable and the flipper rods, not the program.
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.
Make the animal swim out and back to where it started. It must end on the same spot, facing the same way. You may not touch it. Mark where it starts before you run it. Then nobody can argue about the result.
Give it a swim with a rest in it. Swim, pause, then swim again, at two different speeds. The flippers must stroke at a different speed in each swim. You must be able to see it. The animal should make a sound at each change. Then people can see a new part has begun.
Work out how fast the animal strokes, and use it. Turn the motor one rotation. Count how many flipper strokes it makes. Then write a program that swims an exact number of strokes, say twelve, and stops. Someone should be able to count along and get the same number.
Make the animal swim a measured distance, and prove the number. Your Plesiosaurus has no sensors. It has no way of knowing where it is. It does everything by counting turns of its own motor. Your job is to turn that count into distance. Plan on paper before you build. You need to find out how far the animal goes in one rotation. The only honest way is to measure it. Measure it a few times. It will not be the same each time. Decide what you will do about that difference before you see it. Then program it to travel a distance your teacher gives you. Run it once, in front of everyone. No practice run. When you show it, answer two questions. How far off were you, and where did the mistake come from? And would your way still work if someone changed the speed?