Coding Project 12 — Teaching Your Robot New Moves
KIPR · Botball Explorer
Activity Sections

Introductory · EV3 Coding Project 12

Teaching Your Robot New Moves

Give a whole stack a name. Then just say the name.

Project
Coding Project 12
Strand
Coding
Phase
Make It Reliable
Time
One class period
What You Are Doing
Writing your own commands — drive, turn, grab — and calling them instead of retyping them. Then using one of them twice to double a score.
Mission Anchor
Mission 15 — Hazard Disposal #2 (base + bonus) — 18 points
What You Need
Before You Start
Project 11 — your gyro turn must already work, and your measuring card must be filled in.
Before you start: type your PIN in the box at the top of the page. Your teacher gave you this number. When you finish, press Download to save a local copy of your answers. This does not turn in your work automatically; give the downloaded file to your teacher.

Try It — Brain Dump

Without looking anything up, write down every block you know. Fill as many boxes as you can — just the name of each is fine.

Now compare with a partner, then look at your whole list at once. What do all of them have in common? Find at least two things.

You Should Have Found These

  • Every one of them has a name that says what it does.
  • Some need information — the ovals and dropdowns you fill in. Some need nothing at all.
  • Somebody built every one of them, decided what it needs, and put it on the shelf with a name.

Today you join them. The shelf has room for blocks of your own.

Count your own repetition

Open your Project 11 program. Go through it and count.

How many times did you build…TimesBlocks each
The reset-spin-wait-stop turn
The six-step grab sequence
The safe-shape opener
Multiply those out. Roughly how much of your program is copies of something you already built?

Learn It — Three Parts, In This Order

Making your own block is like adding a word to the dictionary. You need the word listed, you need its meaning written down, and then you can use it in a sentence.

Open the My Blocks category and press Make a Block. Name it turn right 90. Two things appear at once:

Code / partWhat it means
1 — the block on the shelfYour new block, sitting in My Blocks like it has always been there. This is the word in the dictionary.
2 — a “define” hat on the canvasA hat block reading define turn right 90. What you snap under this hat is the meaning of the word — what the robot actually does.
3 — the callDrag your new block into your program wherever you would have built all those blocks. This is using the word in a sentence.

The whole thing, side by side

Read the second stack out loud. It is not a pile of machinery any more — it is a list of what the robot does.

⚠ Two Hats, Two Different Jobs

The define hat’s stack runs only when your block is called — never on its own, and never when the program starts. The most common mistake in this project is snapping mission blocks under the define hat by accident, then wondering why the robot does them at the wrong moment — or building the meaning under when program starts and wondering why the new block does nothing.

One canvas, several stacks, and every block belongs to exactly one hat. Check which hat before you snap.

Naming rules

Make it obvious: turn right 90, not thing2. Say what it does, not how it works. Your teammate should be able to read your main stack top to bottom and narrate the run.

Inputs — one block, many distances

A drive forward block that always drives 3.5 rotations is fine until you need half that. And there is a second annoyance hiding with it: every time you drive, you are doing the inches-to-rotations math from Project 4 by hand.

When you make a block, Add an input. Name the input inches. Now your block has a white hole in it, and the number you type there gets handed to the meaning every time you call it — a different number every call, if you like.

New Piece: the Green ÷ Oval

In the green Operators category there is an oval with a ÷ in it and two holes. It divides the first number by the second — and like every oval, it drops into any white number hole. Which means your block’s meaning can do the Project 4 math itself: inches ÷ your inches-per-rotation. Do the arithmetic once, in the define, and never again.

The input oval lives on the define hat. Drag it off the hat into the blocks below — that is how the meaning gets the number. Need two inputs? Add two. This is the same idea as the holes in every block you have ever used.

A block can call another block

Once drive forward and turn right 90 exist, a bigger block can just use them:

Blocks made of blocks made of blocks. That is not a trick — it is how every real program you have ever used is built.

Do It — Build Your Own Commands

Step 1 — My first block

New project called Moves, with your usual s at the top. Make a block called turn right 90, and snap your working Project 11 turn under its define hat — your corrected hexagon number and all.

Call it twice in a row from when program starts. The robot should end up facing backwards.

Step 2 — Break it on purpose

Drag one turn right 90 call out of the main stack and drop it loose on the canvas. Run.

What happened, and why? (Think about which hat the loose block belongs to: none.)

Now snap a play beep block under the define hat, at the bottom of the meaning, and run the program again.

When did the beep happen — and what does that tell you about when a define stack runs?

Put everything back.

Step 3 — Add an input

Make drive forward with an inches input, exactly as in Learn It. Call it with 24, then 12, then 6 — one program, three different distances, one define.

Step 4 — The square — one more time

Make drive square, built from your two new blocks and a repeat 4, exactly as in Learn It. Run it.

Count the blocks in your main stack now, versus the square you built in Project 11. What is the difference?

Step 5 — Wrap the grab

The big one. Make a block called grab and put the whole six-step sequence from Project 8 inside its define — arm down, close, arm up, with its waits.

Then make drop off for the release rules — arm down, open, pause, back straight away.

Your grab uses the claw-closed variable inside the define. If the claw changes tomorrow, how many places do you edit now — counting both the variable and the block?

Step 6 — Mission 15 — one blue pom9 pts

Watch Mission 15 video

Base Mission

9 points Final judged

One Blue Pom is a basket.

Bonus Mission

9 points Final judged

Two or more Blue Poms are the same basket.

Scores

  • One Blue Pom is a basket.
  • One Blue Pom partially extends into the interior space of a basket.
  • Two or more Blue Poms are the same basket.

Does Not Score

  • A Blue Pom is touching only the outside of a basket.
  • A Blue Pom is resting above a basket without extending into it.
  • One Blue Pom is in Basket A and one in Basket B — does not satisfy Bonus.

⚠ Not the Basket You Used in Project 8

Mission 11 (orange poms) and Mission 15 (blue poms) must use different baskets. In Project 8 you wrote down which basket you were saving for this. Use that one.

Build the run out of the functions you just wrote. Your whole main should read like a list of instructions, not a wall of code.

Step 7 — Mission 15 Bonus — do it again9 pts

Here is the payoff for the whole project. To score the bonus you need a second blue pom in the same basket.

You do not write any new code. You call your function a second time.

fetch_pom();
fetch_pom();

Nine Points for One Line

If your function had been twenty lines of copied code, doubling this mission would have meant twenty more lines to write, test, and keep in step. Instead it is one line.

That is the entire argument for functions, and you just got paid for it.

The second pom is somewhere different from the first, so your function will need a way to handle that — an argument, or a small drive between the two calls.

How did you get the second call to reach a different pom?

Step 8 — Run it five times

RunOne pom in?Two in the same basket?Points
1
2
3
4
5

Score It — Checkpoint

My score

Mission partScored?Points
Mission 15 — Base (one blue pom in a basket)9
Mission 15 — Bonus (two in the same basket)9
My total18

My block list

Write down every block you built. This list is the start of something you will finish in Project 16.

Block nameInputsWhat it does

Where does each part go?

PartWhere it lives
The block itself
The meaning
The call

Can you do it again?

Think about it

Your robot’s 90° turn is a few degrees off. With your own blocks, how many places do you edit? Without them, how many?

In Project 9 you gave names to numbers. Here you gave names to actions. What is the same about those two ideas?

A new teammate joins and opens your program. They see a block called fetch pom and have no idea how the inside works. Is that a problem?

Next

Your robot follows the same plan every time, no matter what it finds. If a cube is not where you expected, it grabs at nothing and carries on regardless.

In Project 13 — Deciding What to Do, it stops following orders blindly and starts choosing.

Download saves a local copy of your answers. It does not turn in your work automatically; give the downloaded file to your teacher.

KIPR · Botball Explorer — Introductory Projects · © KISS Institute for Practical Robotics 1997–2026