The Push-up Robot: the Brick lies flat as the body. A Large Motor on each side moves an arm. It pushes itself up off the table, then lowers itself down. Again and again.
Most models so far have moved something else. A fan blade, a barrier, a wheel. This one lifts itself. And the Brick is the heaviest thing in the kit.
So this model will really run out of strength. Then an EV3 motor does something new. It does not stop. It does not carry on. The program just stays where it is, for ever.
In the real world 5 min
Where you have seen it
A press-up tests if you can lift your own body. You need no kit and no weights. Just you, the floor, and how many you can do.
A push-up: the whole body lifted by the arms alone. Photo: Nenad Stojkovic / Wikimedia Commons (CC BY 2.0).
Why it is built that way
Two arms work together to lift a weight that never changes. That is why press-ups are a good test. The weight is always just you. Only your strength changes.
In the end, everyone gets stuck. The arms push as hard as they can. But the body does not rise. Not slowly. Not at all. You are trying your hardest, and nothing happens.
What would go wrong without it
Now think about how that looks to someone watching. They see a person lying still. It looks like they are doing nothing. But they are pushing hard.
A robot like that looks even calmer. A stuck EV3 motor makes a soft buzz and stays still. The Brick shows no error, no message and no light. It has not crashed. It is doing just what your program says. It is waiting for a move that will never finish.
The hardest problem to spot is not a crash. It is a machine doing just what it was told, for ever.
The main concept — the stall 6 min
A measured motor block waits until the move is finished. If the move can never finish, the block never finishes. Then nothing below it ever runs.
You have used this since Lesson 1, without seeing it. A block like run [clockwise v] for (2) [rotations v] does not just start the motor. It holds the program there. It waits until the motor has really turned two times. That is why measured movement helps.
It is also the trap. The block is not counting seconds. It is counting degrees the shaft has really turned. If the shaft gets stuck, the count stops. And the block waits.
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
0°degrees counted90°what the block asked for0.0swaiting at that block
60° reached, 90° asked — waits for everrest of the program never runs
Same arm, same end stop at 60°. One number is different: this program asks for 90.It lifts, and at 60° the arm meets its stop. The shaft cannot turn any further, however hard the motor pushes.Stalled. The block was told 90 and the shaft says 60, so it is still waiting — and it will wait for as long as the Brick is switched on.The screen is still blank. Every block after the motor block is unreachable — the program has not crashed, it is waiting.Finished. One arm, one end stop, and three programs — only one of which is safe to leave running.
lifting
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.
Look at how the demo proves it. There is a block after the motor block. The screen stays blank. You cannot see “the block has not finished”. A stuck motor looks just like a stopped one. But you can see that the next thing never happened.
Block
What it does if the shaft jams
[A v] run [clockwise v] for (1) [rotations v] :: motors
Hangs. It waits for a turn that never comes.
[A v] run [clockwise v] for (2) [seconds v] :: motors
Finishes. Two seconds pass. It does not matter if the shaft moves.
wait until <(timer) > (5)>
Finishes. The way out from Lesson 20. The clock keeps running, no matter what.
So there are two fixes. Really, they are the same fix. Measure something that cannot get stuck. Time always passes. Turns do not always happen.
Is a program stuck? Put a block after the one you think is stuck. Watch for it. A blank screen tells you nothing. A missing message tells you a lot.
▶The Large Motor, and measured movementAll about this motor, and about rotations and degrees. Open one if it is not clear yet.Show meHide
ComponentMotion4 min
The Large Motor
The Large Motor is the bigger of the two EV3 motors. It turns more slowly than the Medium Motor but pushes far harder, which is why it drives wheels and lifts loads. If a mechanism struggles or stalls with a Medium Motor, this is usually the answer.
Large Motor
Medium Motor
The two motors at the same scale. The Large Motor is visibly bigger and heavier — that extra size is what gives it more turning force and less speed.
Blocks reference
Block
What it does
[B v] run [clockwise v] for (3) [rotations v] :: motors
Turns the motor a measured amount, then stops.
[B v] run [clockwise v] for (2) [seconds v] :: motors
Turns it for a length of time rather than a distance, then stops — however far the shaft actually got.
[B v] set speed to (40) % :: motors
Sets how fast the next movement will be.
[B v] start motor [clockwise v] :: motors
Starts it turning and carries straight on.
Watch them race, then watch them lift
Give both motors the same program and the same arm. With nothing on the arm the Medium Motor wins easily — which is why it is tempting to treat it as simply the better motor. Then the demo hangs a weight on both arms and runs it again.
when program starts
A run clockwise for 1rotations
and on the Large Motor, only the port changes
B run clockwise for 1rotations
0%medium lifted0%large liftednoneload
Medium: not enough forceLarge: slower, but it lifts
) : clock.step === 1 ? (
With nothing to lift, the Medium Motor is quicker
The same program, the same arm, one on each motor. Nothing to lift yet.No load: the Medium Motor is clearly the quicker of the two.Now hang a heavy weight on both arms and run exactly the same program.The Medium Motor stalls a third of the way up. The Large Motor keeps lifting.Same program, same weight — the motor was the difference.Finished — it will run again in a moment.
at rest
Turning the speed up would not rescue the Medium Motor here — a stalled motor needs more force, which means gearing it down or using the Large Motor.
That is the whole difference. The Medium Motor is quicker; the Large Motor is stronger. A motor that cannot produce enough force does not move slowly — it stops altogether and strains, which is the buzzing, going-nowhere failure almost every LEGO builder meets sooner or later.
A stalled Large Motor hangs the program too
Being stronger buys the Large Motor a bigger load, not an infinite one. Every winch runs out of cable and every lift reaches the top of its rails, and when a motor arrives at a limit it stalls: the shaft stops turning and the motor sits there straining.
That is a problem for the program, not just the mechanism. run for (3) rotations does not finish when three rotations’ worth of time has gone by — it finishes when the shaft has actually turned three times. A winch that reaches the top after two and a half will never report three, so the block waits, and every block after it is unreachable. Nothing crashes. The motor keeps pushing and the rest of the program simply never happens.
The third setting in that dropdown is the way out. for () seconds drives the motor for a duration and then stops regardless, so it always finishes and the program always moves on. Drive into a limit slowly, for a comfortably long time, and then call that position zero:
when program starts :: events hat
[B v] set speed to (30) % :: motors
[B v] run [counterclockwise v] for (3) [seconds v] :: motors
[B v] reset degrees counted :: motors
The lift ends up against its own stop, the encoder is zeroed there, and every measured move afterwards starts from a place you know. The rule is the same for both motors: if the movement ends against something solid, run for seconds; if it ends somewhere in the middle, measure it. The Medium Motor module has the animation for it — see The Medium Motor, which is where this bites hardest, because a Medium Motor is usually the one doing the lifting.
Which motor for which job
Large Motor — wheels, winches, anything lifting weight. Strong, slower. Normally ports B and C.
Medium Motor — arms, gates, jaws, pointers. Quick, lighter. Normally ports A and D.
The blocks are identical apart from the port letter, so swapping one motor for the other is a build change, not a programming change.
Why it matters
Real machines match the motor to the load. A lift uses a powerful, slow motor; the button panel beside it uses tiny ones. Choosing the wrong size is the most common reason a LEGO mechanism whines but does not move.
ComponentMotion5 min
Rotations and degrees
There are two ways to tell an EV3 motor how much to move: give it a length of time, or give it an amount of turn. Only the second one is repeatable, and that difference decides whether a machine works reliably or only sometimes.
One rotation means one full turn of this shaft — not one turn of the wheel or gear it drives. Gearing between the two changes how far the mechanism actually moves.
Blocks reference
Block
What it does
[A v] run [clockwise v] for (1) [rotations v] :: motors
One full turn of the motor shaft, then stop. The program waits for it.
[A v] run [clockwise v] for (180) [degrees v] :: motors
Half a turn. 360 degrees is one rotation.
Count it as it turns
The counters below tick up in step with the shaft, so you can watch a rotation being counted rather than take it on trust.
The program begins. Nothing has turned yet, so both counters read zero.Turning. Watch the two motor counters climb together — they are one movement counted two ways.Exactly 2 rotations, exactly 720°. The big gear has turned only two thirds of a turn.Finished — it will run again in a moment.
stopped
The two motor read-outs are the same measurement — 1 rotation is 360°. Use whichever makes the number easier to read.
Rotations or degrees?
Notice that the two motor counters finish together: 2.00 rotations and 720° are the same instant, because they are the same measurement in different units. So pick whichever makes the number easier to read. A winch that needs eight full turns is clearest in rotations. A gate that lifts a quarter turn is clearest in degrees — 90 rather than 0.25.
Gearing changes the answer
The third counter is the one that catches people out. The block counts turns of the motor, not of the thing it drives — and the gear in the demo is three times the size, so two motor rotations move it only 0.67 of a turn. Ask for two rotations and the mechanism does not move two rotations’ worth unless the gearing is one to one.
That is why a number that works on one build has to be retuned when the gearing changes — the program is right, the mechanism is different.
Why it matters
A printer feeds paper an exact distance; a lift stops level with the floor; a robot arm returns to the same place a thousand times. None of that is possible by timing a motor — they all count turns.
Say this back before moving on: “A run-for-rotations block waits for the shaft. If the shaft stops, the program stops too.”
What’s in this build 4 min
Part
What it is doing here
EV3 Intelligent Brick
Runs the program. It is also the load. That is the weight the arms lift.
Large Motor ×2
The two arms, ports B and C. This is the strong motor. This model needs all its strength.
Feel the load before you power it
Gently lift the whole model by its arms. That is the weight the two motors must lift. It is more than any motor has moved so far.
Move one arm all the way round by hand. Where does it feel hardest? That is where it will get stuck, if it does.
Check that both arms move the same amount. Is one arm one hole out? Then it hits the table first. Then both arms get stuck.
Look at where the arms touch the table. Are they flat, or on a corner? A corner digs in. Then the push-up gets stuck.
The hardest point is at the bottom. It is just like a real press-up. Pushing up from the very bottom is the hard part. That is where it works, or it does not.
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 arm motor
B
B and C are the pair, like on the Frog in Lesson 26. The pair is for two motors doing one job at once.
Right arm motor
C
Right is C. Sit behind the robot to decide which is which.
Sensors
none
See this? The robot cannot feel that it is stuck. That is the whole problem.
Check your own build now:
Cables in B and C.
Both must be Large Motors. A Medium Motor on one arm gets stuck. The Large one still pushes. Then the robot twists.
Clear space around it. It moves about more than you think.
Use a hard, flat top, not a book or a folder. On something soft, the arms sink in. They get stuck at the bottom.
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.
Stay connected today, whichever you choose. You will make this program get stuck on purpose. You get out with the stop button on the computer. A stuck motor that keeps pushing gets hot.
Confirm the connection 2 min
Check the Brick icon: connected, or not.
A Large Motor on B and one on C.
Move the left arm by hand. Check that it is tile B whose degrees count changes. Then the right arm, and C.
Leave the port tiles on screen while you run today’s programs. A stuck motor shows there. Its degree count stops going up. But the program is still running. That is the best way to see a stall as it happens.
Change it and test 8 min
Today you are going to cause a stall on purpose. Then you will know one when you see it. Keep the stop button close. Never leave a stuck motor pushing for over two seconds.
Run the program. While it is going, hold the body down gently with one finger. The motors buzz. The arms stop. The screen stays blank. Let go after two seconds. Watch it carry on.
Do it again. Watch the port tiles. The degree counts freeze. But the program is still running. That is a stall, shown as a number.
Now hold it down and keep holding. The program does not give up. It does not tell you anything. It does not move on. Stop it from the computer after five seconds.
Change both 120 degrees to 1 second. That is seconds, not degrees. Run it and hold the body down again. Predict what happens to DONE this time.
Step 4 is the fix, but it costs something. Press-ups timed in seconds never get stuck. But they do not go the same distance every time. Which would you choose for a machine like this?
Step 4 is the choice this whole lesson is about. Measured movement is exact. But it can get stuck. Timed movement always finishes. But it is not exact. Neither one is always right.
Rotations promise a distance, but can wait for ever. Seconds promise an ending, but not a distance. Pick the promise your machine really needs.
This is what you are building: the Push-up Robot.
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.
One page at a time — use Next and Previous, or the ← → keys. 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.
Make it move 10 min
Seven blocks. Five press-ups, then a word on the screen. That last block matters most.
when program starts :: events hat
set movement motors to [B v] and [C v] :: movement
set movement speed to (50) % :: movement
repeat (5)
move [forward v] for (120) [degrees v] :: movement
move [backward v] for (120) [degrees v] :: movement
end
write [DONE] at line (1) :: display
The word DONE is not just for show. It tells you if the robot got to the end. A stall looks just like a finish.
Read it in the order the Brick runs it:
set movement motors to B and C. The two arms are a pair. So they push together. Two motor blocks on their own would make a wonky press-up.
set movement speed to 50 %. This is a setting. Go steady. Lifting a weight is not a job for full speed.
repeat (5). Five press-ups.
move forward for 120 degrees. This is the push up. It is measured. So the block waits until the arm has really turned 120 degrees. This is the block that can hang.
move backward for 120 degrees. Back down.
write DONE at line 1. It is outside the loop, after the end. It runs once, when all five are done. If you never see DONE, the robot never finished.
What success looks like: five good press-ups. The body rises off the table each time. Then DONE shows on the screen at the end. All three parts matter. The third one matters most.
If DONE never shows, the robot is stalled. Stop the program from the computer. Then check. Is the surface hard? Are both arms flat? Are both motors Large? Is 120 degrees more than the arms can really move?
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
Make the robot tell you what is going on. It must write READY before it starts. It must count each press-up on the screen as it does it. It must write DONE at the end. It might stall part-way. To stall means the motor is stuck and cannot turn. Then the last number on the screen must show which press-up it got stuck on.
Challenge 2
Find how deep it can go before it stalls. Add more degrees to the push, a little at a time. Stop when the robot can no longer lift itself. Write down the biggest number that still does five press-ups. Then say why deeper is harder. Think about where the arms are pushing.
Challenge 3
Build a version that can never get stuck. Use seconds, not rotations. Make a press-up program that always gets to its last block. It must do this even if you hold the robot down the whole time. Then say plainly what you gave up to be sure of that.
Extra challenge
Make a machine that knows when it has failed.
Your Push-up Robot must try a set of press-ups. Then it must tell the truth about what happened. How many did it do? Did it finish, or was it stopped? Someone who did not watch must be able to tell if it worked. They can only look at the Brick.
Plan on paper before you build. Plan for the failure first. A block that turns a set amount never finishes if the motor stalls. So anything that must run after it has to be reached another way. Work out how before you write a block.
Two questions when you show it. Hold the robot down part-way through. Show us what your machine says about it. And could your robot ever say it worked while it lies flat and stuck?