The Mechanical Crossbow. A motor winds the string back. The string stays back. Then a second motor lets it go. You use two Brick buttons: one to pull, one to fire.
The middle bit is the interesting part. The string stays back. The winding motor has done its job and stopped. A rubber band pulls on it hard, trying to spin it backwards. But it does not move.
Does it hold, or give way? The motor does not decide. Nor does the band, or the build. One drop-down menu in one block decides. That menu is today’s lesson.
In the real world 5 min
Where you have seen it
A big crossbow’s string is far too stiff to pull by hand. So people used a windlass: a handle and a rope. You wind the handle, and the string comes back. Then you let go of the handle. The bow stays loaded.
A wind-up crossbow. The handle at the back does the pulling. Something has to stop it unwinding. Photo: Thomas Quine / Wikimedia Commons (CC BY 2.0).
Why it is built that way
What if you let go of that handle with no ratchet? The whole thing runs backwards. The string pulls very hard. The handle is the easiest way for that pull to get out. It would spin the handle out of your hand.
So every windlass has a ratchet. A little catch drops into the teeth of a wheel. It lets the wheel turn one way only. The ratchet does not help with the pulling. It is only there for the moment after the pulling stops.
What would go wrong without it
No ratchet, no loaded crossbow. You could pull the string back perfectly. But it would unwind as soon as you stopped winding. Every time.
Half of building is making a thing move. The other half is making it stay where you put it.
The main concept — stopping has a setting 6 min
When a motor stops, it does one of two things. It holds on, or it lets go. Your EV3 motor has no ratchet inside. But it can push back to hold itself still, which does the same job. This block turns it on.
[A v] set motor to [hold position v] at stop :: motors
A setting, not an action. It changes what every later stop on motor A does.
Setting
What the motor does when it stops
Use it when…
coast
Lets go fully. The axle spins freely. You can turn it with a finger.
Nothing pulls on it, or you want to move it back by hand.
brake
Stops fast and resists turning. But a strong pull can still force it round.
You want a sharp stop, without using power to hold it.
hold position
Fights back. If something moves the axle, the motor pushes it straight back.
Something is pulling: a load, a spring, or the weight of a part. This is the crossbow.
ComponentMotion4 min
Brake or coast
Telling a motor to stop does not say how it should stop. There are two very different behaviours, and which one you want depends entirely on what the mechanism is holding up.
Brake — the motor actively holds its position. A lifted arm stays lifted; a robot stops dead where it is.
Coast — the motor lets go. A lifted arm sags under its own weight; a moving robot rolls on a little before stopping.
When this motor is told to stop, it either holds its shaft still or lets it spin freely. Which one it does is the whole of this module.
Watch what happens after the stop
Both arms below are lifted by the same program and stopped at the top. The only difference is one word in the stop block. Everything worth seeing here happens after the movement has finished.
when program starts
A run clockwise for 1rotations
A stop motor brake
the only change on the other arm
A stop motor coast
0%braked, held0%coasting
Brake: still where it was putCoast: back on the floor
Two identical arms, each with a weight on the end.Both motors lift their arm to the top. So far the two are the same.Both are now told to stop — one set to brake, the other set to coast.The braked arm holds. The coasting arm lets go and falls under the weight.Same lift, same stop block, opposite results.Finished — it will run again in a moment.
stopped
If a mechanism you just lifted sags the moment it stops, the stop action is the first thing to check — not the lifting movement.
The coasting arm does not slide down steadily — it starts slowly and picks up speed, because it is gravity pulling it and not a motor lowering it. That is also why a coasting robot rolls a little past where its measured movement ended.
Which to choose
If gravity is pulling on the mechanism, you almost always want brake — otherwise the thing you just lifted comes back down on its own. If you want a smooth, natural halt, or you want to be able to push the robot by hand afterwards, coast is friendlier.
Coasting also makes a robot travel slightly further than its measured movement, because it keeps rolling after the motor has finished. On a precise task that error matters.
Why it matters
A crane must brake — a coasting crane drops its load. A train coasts into a station rather than stopping dead, because passengers would be thrown forward. The same choice, made differently, for good reasons.
The demo above lifts two arms with the same program. It stops them the same way. Everything worth watching happens after the move ends. Most people never think about that part of a program.
If something pulls on your moving parts, the stop setting matters a lot.
Holding uses power. On hold position, the motor works the whole time it holds. It gets warm and uses up the battery. That is fine for the minute your crossbow is loaded. It would not be fine for an hour.
▶Brick buttons as inputsThe five buttons on the Brick, and how a program listens for one. Open it if the button hats are new.Show meHide
ComponentSensing4 min
The Brick buttons
The Brick has five buttons of its own — up, down, left, right and centre. They need no sensor, no cable and no port, which makes them the easiest way to let a person tell the robot to do something.
Five buttons — up, down, left, right and centre — built into the Brick. No cable, no port, no sensor to plug in.
Blocks reference
Block
What it does
when [center v] button [pressed v] :: events hat
Starts a whole stack when that button is pressed.
wait until <is [center v] button pressed? :: sensors>
Holds an existing program until the button is pressed.
Press to begin
A program sitting on a wait block looks exactly like a program that has crashed. Watch one wait — including through two presses of the wrong button.
when program starts
wait until is center button pressed?
A run clockwise for 1rotations
the other way to do it
when center button pressed
A run clockwise for 1rotations
The program has reached the wait block. It is not stuck — it is waiting, and nothing below it will run until the centre button goes down.Up is pressed. The button reporter changes to 4, but this wait is watching the centre button, so the program stays where it is.Right: 3. Still not the one.Centre: 2. The condition is true and the wait lets go.The motor runs. One press, at the moment a person chose.Finished. The robot did nothing at all until a person said so.
waiting for centre
A program parked on a wait block looks identical to a crashed one. This is why the status light or a line on the screen is worth setting before you wait.
The wait is watching one button. Up and right change the (button) reading, and the program does not care. That reading is a number rather than a name: 0 for nothing, then 1 left, 2 centre, 3 right, 4 up, 5 down.
A hat, or a wait?
A hat gives the button its own separate stack, which can run at any time. Good for a control the user may press whenever they like.
A wait puts the button in the middle of a sequence. Good for “press to begin”, where nothing should happen before it.
Why it matters
Nearly every machine has a start button that is deliberately separate from switching the power on. A robot that begins moving the instant it is powered up is hard to set down and hard to test — one that waits for a press can be positioned first.
Say this back before moving on: “Coast lets go, hold fights back.”
What’s in this build 4 min
Part
What it is doing here
EV3 Intelligent Brick
Runs the program. Its five buttons are the controls. You need no sensor to fire this one.
Large Motor — the winch
The winch winds the string back against the rubber band. This job needs strength, so it gets the Large Motor. Its stop setting is the one that matters.
Medium Motor — the trigger
Flicks the catch out of the way. It needs to be fast, not strong. A slow trigger lets the string out unevenly.
The rubber band (not electronic)
Stores the energy. It also tries to undo your winch all lesson.
Safety comes first
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
Winch (Large Motor)
A
A motor with a job, not a wheel. You will change its stop setting, so put it where you will remember.
Trigger (Medium Motor)
D
The far end of the Brick. That keeps the trigger cable well away from the string.
Sensors
none
The Brick’s own buttons are the input today. There is nothing to plug into ports 1–4.
Check your own build now:
Find the motor that turns the winch. Follow the string, not the cable. Put it in A.
The trigger motor goes in D.
Run both cables behind the string. A cable in front of a loaded crossbow will get hit.
Wind the winch a little by hand, then let go. It should unwind. That is what coast feels like. You are about to change it.
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.
Bluetooth suits this one. You will press the Brick’s own buttons. So the Brick needs to be in your hand or in front of you. A cable would tie it to the laptop.
Confirm the connection 2 min
Check the Brick icon: connected, or not.
You should see a Large Motor on A and a Medium Motor on D. They are two different pictures. If both tiles look the same, one motor is the wrong kind.
Turn the winch by hand. Watch tile A count. Now you know the winch is where you think it is.
You do not need to test the buttons in the app. They are on the Brick, and you will hear them work soon.
Change it and test 8 min
Make one change at a time. After each one, pull the string back and wait ten seconds before you fire. Most of today’s test happens during that wait.
Change motor A to coast at stop. Pull the string back and let go. Watch it unwind. This is the crossbow with no ratchet. It is worth seeing once.
Change motor A to brake. Pull it back and wait. Does it hold, or creep? Try again with the band stretched further.
Put A back on hold position. Now try to turn the winch with your fingers while it is loaded. Feel it push back.
Change the pull to 3 rotations. More stretch means more power, and a harder job for the hold. Does it still hold?
Change the trigger speed from 100% to 20%. Fire it. A slow trigger is a bad trigger. That is why the trigger motor runs at full speed.
Step 5 surprises people. Everywhere else in this course, slower has meant more careful and more exact. A trigger is different. It must let go faster than the string moves. If not, the catch drags on the way out.
Choose the stop, not just the start. “Where does it end up?” is a different question from “how does it move?”
This is what you are building: the EV3 Mechanical Crossbow.
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.
Make it move 10 min
Three stacks. One sets the machine up when the program starts. Then there is one for each button. It is the same trick as the Crane, in Lesson 25.
when program starts :: events hat
[A v] set motor to [hold position v] at stop :: motors
[D v] set motor to [coast v] at stop :: motors
when [up v] button [pressed v] :: events hat
[A v] run for (2) [rotations v] at (30) % speed :: motors
when [down v] button [pressed v] :: events hat
[D v] run for (1) [rotations v] at (100) % speed :: motors
Up pulls the string back. Down fires it. The setup stack keeps the string back in between.
Walk it through:
Press Play. The setup stack runs once and ends. Nothing moves. Settings are not actions.
Press UP. The winch pulls the string back, 2 turns, slowly, at 30%. Slow matters here. Winding fast against a rubber band can pull a model apart.
The winch stops, and holds. The band is pulling. The motor pulls back just as hard. Nothing happens, and that is the whole point.
Press DOWN. The trigger motor snaps round at 100%, and the string goes. Then it coasts. So you can flick the catch back with a finger and load again.
What success looks like: press UP and take your hands off. Count to ten out loud. The crossbow is still loaded.
If the string creeps back while it is loaded, the winch is on brake, not hold position. Brake resists, but it does not fight back. A strong band slowly beats it. Change that one drop-down.
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
Load the crossbow and walk away. Pull the string back. Take your hands off. Leave it for a full minute. Do not touch the model. After the minute, the string must be just as tight as at the start. Does it creep, or slide back slowly? Then say which stop setting you used. Say what you changed it to.
Challenge 2
Make the crossbow show if it is loaded. A person walking up should know if the string is pulled back. They should only need to look at the Brick. Use the screen, the status light or a sound. You choose. Then test it. Load it. Hand it to someone who has not watched. See if they can tell.
Challenge 3
Find where brake stops being enough. Set the winch to brake, not hold position. Each run, pull the string back a little further. Stop when it starts to creep back. Write down the point where it fails. Then explain in one sentence. What does hold position do at that point that brake does not?
Extra challenge
Build a way to load it that cannot go wrong. It must be safe even when someone else uses it.
A loaded crossbow holds stored energy. The next person to use it may not be the person who wrote the program. Your job is to make the whole cycle safe for a stranger: load, wait, fire, reset.
Plan on paper before you touch the program. Decide three things. What does the machine do the moment it is switched on? Then nobody gets a surprise. What stops a second press of the draw button? It must not wind a string that is already back. And how does a person know it is safe to come close?
Then test it well. Hand it to someone from another group. Do not explain anything. Stand back and watch. Do not help them. Write down each time they stop to think. Write down each thing they do that you did not expect.
Answer two questions when you show it. What did your tester do that you had not planned for? Also, your crossbow cannot tell if the string is really pulled back. It only knows what it was last told to do. Say just what you would add to the model, and where. Then it could know for sure.