The Mechanical Frog: two motors, one for each back leg. Swing both legs back together and the frog shoves itself forward; bring them back and it is ready to go again.
The Walking Bot in Lesson 10 had one motor and stepped along. This has two, and they are not taking turns — they have to move at the same instant, or the frog does not go forward at all. It turns.
An honest warning: it will not actually leave the ground. The motors are not fast enough to throw the whole model into the air, and the catalogue says so plainly. It shuffles forward in hops. That is a real limit of real hardware, and getting it as close to a jump as it can go is the mission at the end.
In the real world 5 min
Where you have seen it
Malaysia is full of frogs — you can hear them from any drain after rain. A frog can clear twenty times its own body length in one jump, which for a person would be most of a football pitch.
A frog mid-leap in the monsoon of the Western Ghats, its back legs extended together. Photo: Shiv’s fotografia / Wikimedia Commons (CC BY-SA 4.0).
Why it is built that way
Look at the photograph. Both legs are doing exactly the same thing at exactly the same time. That is not a coincidence — it is the only way a jump works.
A frog’s back legs are long, which lets them push against the ground for a long time, building speed all the way. And they fire together. If one leg pushed a fraction before the other, the frog would spin off sideways instead of going where it was looking.
What would go wrong without it
Now think about your two motors. If your program drives one and then the other — even a tenth of a second apart — the frog gets a shove on one side, then a shove on the other. It does not go forward. It waddles, and it slowly turns.
You have felt this yourself. Rowing a boat with one oar at a time takes you in a circle; both together take you across the lake.
Two pushes, one after the other, is not the same as one push twice as big. Together is a different movement, not just a faster one.
Before you build 1 min
This model has no step-by-step manual, and the video below is not one. It is a film of a finished frog moving — worth watching closely for how far the legs actually swing, and for how modest the hop really is. Then build from the model your teacher has. You are not missing a page; the page does not exist.
The main concept — two motors, one movement 6 min
EV3 has a whole category of blocks for driving two motors as a pair. You met them on the Driving Base in Lesson 1. They are not only for wheels.
Block
What it does
set movement motors to [B v] and [C v] :: movement
Says which two ports are the pair. A setting — it moves nothing, exactly like set speed in Lesson 21.
move [forward v] for (90) [degrees v] :: movement
Turns both motors, the same amount, starting and stopping together.
set movement speed to (100) % :: movement
Sets the speed for the pair. Another setting.
Why not just use two motor blocks?
Because they would run one after the other. A [B v] run for (90) degrees block waits until B has finished before the next block starts — so C has not even begun moving yet. Two motor blocks in a row give you a left kick, then a right kick. That is a waddle.
One move block is a single instruction to a pair. Both start on the same tick and both stop on the same tick, and the Brick keeps them level while they run.
when program starts
set movement motors to B and C
move for 2rotations at 5050 % speed
50left wheel · B50right wheel · C
Equal speeds → a straight line
Both wheels are set to the same speed.Equal speeds, so the robot tracks straight — the trail is a straight line.Two rotations later it is exactly where it was pointed.Finished — it will run again in a moment.
stopped
The path is worked out from the two wheel speeds in the block, not drawn by hand — so changing the preset changes the numbers and the shape together.
The demo is a driving base, because that is the easiest place to see the effect — equal speeds go straight, unequal speeds curve towards the slower side. Your frog has exactly the same problem with different scenery: legs out of step means a frog that veers.
Two motors that must stay in step are a pair, not two motors. Tell the Brick that once, and it does the keeping-in-step for you.
▶Driving with two motors, and copying animalsThe full reference for the Movement blocks, and for biomimetics — why so many models in this course are shaped like living things.Show meHide
ComponentMotion6 min
Driving with two motors
A driving base has two Large Motors, one per wheel. You could drive them with two separate motor blocks — but they would never start at quite the same instant, and the robot would curve away. EV3 has a separate family of Movement blocks that treat the pair as a single driving base.
port B
port C
A driving base is two Large Motors, normally in ports B and C. The Movement blocks treat this pair as one machine rather than two separate motors.
Blocks reference
Block
What it does
set movement motors to [B v] and [C v] :: movement
Tells the Movement blocks which two ports are the driving wheels. Put it at the top of the program, before any movement.
move [forward v] for (2) [rotations v] :: movement
Drives both wheels together, so the robot travels in a straight line.
move for (1) [rotations v] at (75) (25) % speed :: movement
Drives the two wheels at different speeds, which makes the robot curve.
set movement speed to (50) % :: movement
Sets how fast the driving base travels from now on.
The letters must match the sockets
set movement motors to [B] and [C] is the block that decides which two motors every Movement block after it will drive. It does not look at the robot. It drives the two ports you name, whether or not there is a motor in them — so those two letters have to be the two sockets the cables are actually in.
This is the single commonest reason a driving base does nothing, and it is invisible in the program: every block is spelled correctly and the robot still will not go.
Two robots, and the very same program: drive the motors in ports B and C forward.Check the cables. The left robot's motors are in B and C — the two the block names. The right robot's are in A and B.Run it. On the left both wheels are driven and the robot goes straight. On the right only port B has a motor the block is talking to; port C is empty, and the motor in A is never mentioned.So one wheel turns and the other does not, and the robot swings round its dead wheel. Nothing failed, nothing was reported — the program drove the ports it was told to.Finished. Identical programs, identical robots — different sockets.
stopped
The yellow outline marks the two ports the block is driving. A robot only goes straight when both of them have a motor in them.
Both robots run the identical program. The left one has its motors in B and C, so both named ports have a motor and the robot drives straight. The right one is plugged into A and B: the block drives B, finds nothing in C, and never mentions the motor in A at all — so one wheel turns, one wheel sits there, and the robot swings round the dead one instead of driving.
If neither named port has a motor in it — cables in A and D, say, with the block still set to B and C — the robot does not move at all. The program runs happily to the end and the Brick reports nothing wrong, because as far as it is concerned it did exactly what it was told.
So before you look for a bug in the program, look at the cables: read the port letters off the Brick, then make the block say those two. B and C are only the usual choice, not a rule — if your build has the driving motors in A and D, set the block to A and D and everything works.
Straight, curved, and on the spot
Everything a driving base can do comes from those two speed numbers. Try each button below and watch the trail the robot leaves.
when program starts
set movement motors to B and C
move for 2rotations at 5050 % speed
50left wheel · B50right wheel · C
Equal speeds → a straight line
Both wheels are set to the same speed.Equal speeds, so the robot tracks straight — the trail is a straight line.Two rotations later it is exactly where it was pointed.Finished — it will run again in a moment.
stopped
The path is worked out from the two wheel speeds in the block, not drawn by hand — so changing the preset changes the numbers and the shape together.
Both wheels the same speed — the robot goes straight.
One wheel faster than the other — it curves towards the slower side. The bigger the difference, the tighter the curve.
One wheel forward, the other backward — it spins on the spot, which is how a robot turns in a space no wider than itself.
Notice there is no steering block anywhere in that program, and no steering part anywhere on the robot. The turn is made entirely by driving the two wheels different amounts.
when program starts :: events hat
set movement motors to [B v] and [C v] :: movement
move [forward v] for (2) [rotations v] :: movement
move for (1) [rotations v] at (50) (-50) % speed :: movement
How far is one rotation?
“Move forward 2 rotations” says nothing about the floor — it says how many times the wheels go round. How far the robot actually travels depends on how big the wheels are, and once round a standard EV3 driving wheel is about 17.5 cm.
Before doing any sums, get a feel for it. Drag the robot along and watch both scales at once — rotations on top, centimetres underneath, the same line. Land on the half marks: there is a number between 1 and 2, and it is 1.5.
Drag the robot, or use the arrow keys — it moves in half rotations. Rotations above the line, centimetres below.
1.5 rotations26.3 cm
1.5 — a half rotation past 1. Half a turn of the wheels is 8.75 cm, so halves matter.
cm=2rotations
35 ÷ 17.5 = 2. That is a number you can type straight into the block.
1 rotation = 17.5 cm. Two rotations is 35, three is 52.5.
Halves are real. 1.5 rotations is a perfectly good thing to type into the block, and it is 26.25 cm — right between the 1 and the 2 you already tried.
To go a distance you have chosen, divide by 17.5. The calculator does it, but do a few by hand first — 35 ÷ 17.5 = 2 is worth seeing.
Measure your own wheels before trusting the number. A base built with different wheels travels a different distance per rotation, and every calculation on this page moves with it.
set movement motors to [B v] and [C v] :: movement
set movement speed to (30) % :: movement
move [forward v] for (2) [rotations v] :: movement
Turning on the spot
Steering at right 100 or left 100 drives the two wheels in opposite directions, so the base stops travelling and pivots where it stands. The angle it sweeps is a simple doubling of the rotations:
Half a rotation is the one worth remembering: a square corner, 90°.
Rotations
The robot turns
0.25
45° — half a corner
0.5
90° — a square corner
1
180° — turn round and face back
2
360° — all the way round
The one to memorise is 0.5 rotations = 90°. Everything else follows from doubling or halving it.
set movement speed to (20) % :: movement
move [right: 100] for (0.5) [rotations v] :: movement
Turn slowly. The wheels on a driving base are big and the robot carries a lot of weight, so at full speed it keeps going after the motors stop and lands past the angle you asked for. Somewhere between 15% and 30% speed is where turns become repeatable. A turn that overshoots is almost always a turn taken too fast, not a wrong number.
These figures belong to your robot. The distance depends on the wheels and the angle depends on how far apart they are, so a wider base needs a different number for 90°. Test it, measure what actually happened, and adjust — the same discipline as the Gyro Sensor tolerance.
Why it matters
Every wheeled vehicle steers this way — a tank, a digger, an office chair with two driven castors. Cars use a steering rack instead, but a robot that turns by driving its wheels at different speeds needs no steering mechanism at all.
ComponentMechanics5 min
Biomimetic mechanisms
Biomimetics is copying a solution from nature. Not the look of an animal — the mechanism. Wheels are a human invention and a very good one, but nothing in nature has them, and there are places a walking machine goes that a wheeled one cannot.
The idea that has to land first
Nothing in a walking robot walks. There is a motor going round and round at a perfectly steady rate — the same motion that drives a car — and a linkage: a set of bars pinned together whose shape turns that circle into a footstep.
Push down, lift, swing forward, put down. No sensor decides when to do each part, and no block in the program says step. The bars do it, because of how long they are and where they are pinned.
1motor, turning one waydownnear foot½turn between the legs
rotation ina stride outno sensors, no code
One motor, turning steadily — the same motion that drives a wheel. Nothing here speeds up, slows down or reverses.Watch the foot rather than the crank. It is flat and slow along the ground, then lifts and swings quickly over the top.The two legs are half a turn apart, so one foot is always down. That is what stops the body dropping between steps.Finished. A steady circle in, a stride out — and not one part of it was told to walk.
still
The faint circle is the crank pin. The green outline is where the foot goes. They are driven by the same axle and they are not remotely the same shape — that difference is the linkage.
The two paths on that stage are the whole module. The crank pin travels a perfect circle. The foot travels something flat along the bottom and arched over the top — and they are driven by the same axle at the same speed. Everything between them is link lengths.
Why the foot path matters
Flat along the bottom. While the foot is on the ground it must travel in a straight line at a steady rate, or the body bounces and the robot shuffles instead of walking.
Lifted on the return. High enough to clear the ground and whatever is on it. A higher arch climbs better and wastes more effort.
Legs out of phase. With legs half a turn apart there is always a foot down, so the body never drops. Four or six legs in pairs is steadier still — which is why insects keep three feet down at a time and are almost impossible to knock over.
The famous designs are worth looking up by name: Jansen linkages (the strandbeest walkers), Klann linkages, and the four-bar “Chebyshev” walker. All of them are the same trick with different numbers.
Other things worth copying
In nature
As a mechanism
A caterpillar or inchworm
Anchor one end, contract, anchor the other, extend. Slow, and it climbs anything.
A fish tail or a snake
A chain of segments swung out of phase — a travelling wave that pushes backwards.
A bird wing
A four-bar linkage that flaps and feathers at once, from one rotation.
A hand or a claw
Linked fingers driven from a single input, so they close around a shape rather than onto a fixed position — a lever chain that adapts by itself.
Walking versus wheels
Be honest about the trade, because it is the engineering content of the whole topic. Wheels are far more efficient, far simpler and far faster on anything flat. Legs are worth their complexity when the ground is not flat: steps, rubble, soft sand, gaps. A walking machine chooses where to put its feet; a wheel has to roll over everything in between.
Building one out of LEGO
Link lengths are everything, and a stud out is a broken gait. Build one leg, get its foot path right, and only then copy it.
Legs need to be built in mirrored pairs on a common axle, half a turn apart. Getting that phase wrong is the usual reason a walker rocks in place.
Walking is hard work — expect to gear down heavily, and expect it to be slow.
A tall walker tips easily. Keep the Brick low and the stance wide — see Centre of gravity.
Why it matters
Robots that copy animals are how machines reach places wheels cannot: search and rescue in collapsed buildings, inspection inside pipes, planetary rovers over loose ground. Studying the mechanism instead of the appearance is what turns an interesting animal into a working machine.
Say this back before moving on: “Two motor blocks happen one after the other. One move block happens to both at once.”
What’s in this build 4 min
Three parts with cables. There is no manual, so you tell us which motors these are — but you can already say something useful about them without knowing: there are two, and they are the same as each other.
Part
What it is doing here
EV3 Intelligent Brick
Runs the program and is the frog’s body — most of the weight the legs have to shift.
Two motors, one per back leg
Ports B and C. They must be the same kind as each other, or one leg will be stronger than the other and the frog will curve however carefully you program it.
Check the legs are a matched pair
Hold the two motors side by side before you mount them. Same body, same shape, same size? If one is a Large and one a Medium, stop and find a match.
Turn each leg by hand through its full swing. Do the two legs travel the same distance? A leg mounted one hole further along the beam sweeps a different arc.
Are they mirror images? A frog’s legs are symmetrical. Yours should be too, which means one motor will be turning clockwise while the other turns counterclockwise to push the same way.
Sit the frog on the table. Does it rest level, or does it lean?
Step 3 is the one that bites. If the two motors face opposite ways, a move forward block will drive one leg back and the other forward. The fix is in the build: mount them so both legs sweep the same way, or flip which motor is B and which is C.
Ports — and the rule 4 min
Sensors go in ports 1, 2, 3, 4. Motors go in ports A, B, C, D. They are not interchangeable, and nothing will tell you politely if you swap them.
Today is the first time in ten lessons that the motor is not in port A — and there is a reason. B and C are the pair. The Movement blocks default to them, every driving base in this course uses them, and a motor pair anywhere else has to be declared.
Part
Port
Why this one
Left leg motor
B
Left is B by convention across the whole course. Keep it, and another group’s program will run on your frog.
Right leg motor
C
Right is C. The pair is always B and C, in that order.
Sensors
none
The frog cannot see where it is going.
Check your own build now:
Left leg in B, right leg in C. Letters, not numbers — and the right way round.
Sit behind the frog, facing the way it will travel, to decide which is left. Deciding from the front gets it backwards.
Swing both legs by hand. Free, and equal, and nothing catching.
Route both cables over the frog’s back and out behind. A cable under a leg is a brake on one side only, which produces exactly the veering this lesson is about.
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 if you can. This model travels, and a USB lead dragging behind it pulls on one side — which will look exactly like the legs being out of step. Do not spend the lesson debugging a cable.
Confirm the connection 2 min
Check the Brick icon: connected, or not.
Check the port tiles. A motor on B and a motor on C, nothing on A or D, nothing on the numbered ports.
Both tiles must say the same kind of motor. One Large and one Medium is a frog that will always curve, and no program can fix it.
Swing the left leg by hand and check that it is tile B whose degrees counted moves. Then the right, and C.
Step 4 catches a swapped pair. On a frog, swapped legs are almost invisible until you notice it is turning the wrong way.
Make it move 10 min
Six blocks. Two settings, then a loop of kick-and-return. Notice there is not a single [B v] run block in it — the whole program talks to the pair.
when program starts :: events hat
set movement motors to [B v] and [C v] :: movement
set movement speed to (100) % :: movement
repeat (5)
move [forward v] for (90) [degrees v] :: movement
move [backward v] for (90) [degrees v] :: movement
end
Both legs kick back together, both return together, five times over. One block per movement, not one block per leg.
Walk it in the order the Brick runs it:
set movement motors to B and C — a setting. Nothing moves. It tells the Brick which two ports are the pair from here on.
set movement speed to 100 % — also a setting, also nothing. A jump needs all the speed there is.
repeat (5) — five hops.
move forward for 90 degrees — the kick. Both legs sweep together and the frog shoves itself along.
move backward for 90 degrees — the legs come back to where they started, ready for the next one. Equal and opposite, so the legs do not creep round.
What success looks like: five hops in a reasonably straight line, both legs visibly moving as one, and a frog that ends up somewhere ahead of where it started. It will be a shuffle rather than a leap — that is the hardware, not your program.
If it turns instead of going forward, work through these in order: are both motors the same kind, are the legs mounted symmetrically, is a cable dragging on one side, and is one leg catching on the frame? Every one of those is a build problem, and none of them can be fixed in the program.
Change it and test 8 min
One change at a time, and predict before each run. Mark the start line with tape and measure how far five hops carry it.
Change the kick to 150 degrees. A longer push against the ground. Predict whether it goes further per hop, then measure.
Now the important one. Replace the two move blocks with four single-motor blocks: B forward, C forward, B back, C back. Predict what the frog does. It waddles and turns, because the legs are now taking turns.
Put the move blocks back, then change set movement speed to 30 %. Does a slow, strong push move it further than a fast one? On a shove-based machine the answer is often yes, and it surprises people.
Add a wait (0.5) seconds between the kick and the return. Predict whether the frog goes further. Give the hop time to finish before you pull the legs back under it.
Try move [backward v] first and forward second. Which way round does your build actually push? On some frogs the legs are mounted the other way and the whole program runs in reverse.
Step 2 is the demonstration this lesson is built around. Same motors, same degrees, same speed, same number of hops — and a completely different animal, because four blocks in a column cannot do what one block does to a pair.
“At the same time” is something you have to ask for. A program does one thing after another unless you say otherwise.
This is what you are building: the Mechanical Frog.
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.
Use the viewer's own controls to zoom and turn pages. Fullscreen makes it big enough to build from.
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.
Challenges & mission 27 min
Work through the challenges in order — each is harder than the last. The mission comes after all three, and it is meant to make you plan before you build.
Challenge 1
Make it hop straight. Mark a start line and a finish line a metre apart with a lane the width of your frog, and get it from one to the other without leaving the lane. Three runs, all three inside the lane, with no adjustment between them.
Challenge 2
Find the best kick. Test at least four different kick angles, measuring the distance covered in five hops each time, and report which angle went furthest. Then explain why the biggest angle is not automatically the best one.
Challenge 3
Make it turn on purpose. Using the Movement blocks, make the frog hop forward three times, turn to face a new direction, and hop three more. The turn must be deliberate and repeatable — the same amount every time — rather than the accidental veering you have been trying to eliminate.
Mission
Get it as close to a real jump as this hardware allows, and say honestly how close that is.
The catalogue says these motors are not fast enough to lift the model off the ground. Your job is to find out how true that is. Change anything you like about the build and the program — leg length, kick angle, speed, where the weight sits, how the legs meet the ground — and get the frog to travel as far as possible in five hops.
Plan on paper before you rebuild. A jump needs the legs to still be pushing when the body is already moving fast, so work out which change gives you a longer push rather than just a harder one.
Two questions when you demonstrate it. Did any part of your frog leave the ground, and how do you know rather than think? And which of your changes made the biggest difference, with the measurements to back it up?