Coding Project 11 — Counting and Turning by Feel
KIPR · Botball Explorer
Activity Sections

Introductory · EV3 Coding Project 11

Counting and Turning by Feel

Same checking as last time — but now it watches a number instead of a switch. Two numbers, actually.

Project
Coding Project 11
Strand
Coding
Phase
Make It Reliable
Time
One class period
What You Are Doing
Reading the counter built into every motor, meeting the sense that feels the whole robot turn, and delivering freight to the loading dock.
Mission Anchor
Mission 9 bonus · Mission 8 · Mission 18 base — 40 points
What You Need
Before You Start
Project 10 — you must be comfortable with wait until , hexagons, and where the stop goes.
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 — The Counter Was Always There

Back in Project 3 you turned a wheel with your hand and watched a number change in Port View. You were told to remember it. Here it is.

Open Port View on a wheel motor’s port. Do not run anything — just roll that wheel with your hand and watch its number.

QuestionWhat I saw
What happens to the number when I roll the wheel forward?
What happens when I roll it backward?

Every Motor Has Been Counting This Whole Time

Since Project 3, your motors have been keeping track of exactly how far they turned — in degrees. Every move for rotations block you have ever run was secretly this count — one rotation is just 360 of these degrees. And degrees are about to earn their keep.

Find your degrees per inch

Degrees are the motor’s own unit. To connect them to the real world you need to know how many make an inch on your robot.

  1. Put the robot on the floor and mark where the front edge sits.
  2. Note the wheel’s number in Port View (or roll it to a nice round number).
  3. Push the robot straight forward exactly 24 inches. Slowly, and in a straight line.
  4. Read the number again. The difference is your degrees for 24 inches.
TryDegrees for 24 inchesDegrees per inch (divide by 24)
1
2
3
Average

⚠ Measure Long, Not Short

Use 24 inches, not 3. A small error in a short push turns into a big error per inch. Anything under about a foot is not worth measuring.

Your three numbers are not identical. Why not — and which one should you use?

Wheel Size Decides the Number

One full wheel turn is 360 degrees no matter what wheel is bolted on. But a bigger wheel travels further in that turn — which is exactly why your degrees-per-inch is yours and not somebody else’s. Change your wheels, and this number changes with them.

Check the curtain: multiply your degrees-per-inch by 24. Is that close to what a move for 24 in. block must be counting to? What does that tell you about how the move block works?

Learn It — A Number Instead of a Switch

Project 10’s checking watched a switch. The exact same checking can watch a number — and the brick hands you two of them as round reporter ovals that fit into any hexagon.

Code / partWhat it means
A degrees countedHow far that wheel has rolled since its count was reset. This is the counter from Try It.
angleHow far the whole robot has turned. Not the wheels — the robot. It comes from the gyro sensor, a small sensor that feels rotation the way your inner ear does when you spin with your eyes shut. Ours plugs into sensor port 2.

Both reporters are on the regular shelf: degrees counted in the Motors category, angle in the light-blue Sensors category.

⚠ The Gyro's One Demand: Hold Still

Mount the gyro sensor flat on the robot and plug it into port 2 — while the robot is sitting perfectly still. The gyro learns what “not turning” feels like at the moment it wakes up. Plug it in, or power the brick on, while the robot is moving and the angle will slowly drift all by itself for the rest of the session. If your angle wanders while the robot sits still: unplug the gyro, hold the robot still, and plug it back in.

The same checking you already know

Look at these two side by side. Only the question changed.

Read the new one out loud: “keep checking the robot’s heading — the moment it has turned past 89 degrees, move on.” The green > hexagon from Project 10 finally gets its job.

Turning by feel

In Project 5 you tuned a 90° turn by trial and error, because wheel degrees are not robot degrees. The angle is robot degrees. Here is the turn, rebuilt:

Why This Beats a Wall

A touch sensor only helps where there is something to touch. The angle works anywhere on the field — open floor, mid-run, anywhere. And unlike wheel counting, it does not care if a wheel slipped. It feels the robot itself.

It will go too far. Every time.

Run that turn and then read the angle in Port View on port 2. You asked to stop past 89. You will see something like 96.

Nothing is broken. Your robot has inertia — it is spinning, and when the checking succeeds and the motors stop, it keeps swinging a little further.

Left turns count down

Turning right, the angle climbs. Turning left, it falls — through zero and into negative numbers. That flips your hexagon:

Code / partWhat it means
right turnsteering 100  ·  wait until angle > 83
left turnsteering −100  ·  wait until angle < −83

⚠ Get the Direction Right or the Checking Never Ends

Spin left while waiting for the angle to pass > 83 and you have a check that can never succeed — the number is falling, away from 83, forever, while the robot spins on the spot like a figure skater who forgot the rest of the routine.

Turning right, count up with >. Turning left, count down with <. Check this before every run.

Do It — Turn by the Numbers

Step 1 — Measure your overshoot

New project called Gyro Turn. Build the Learn It turn — reset angle, spin at steering 100, wait until past 89, stop. Run it, then read the final angle in Port View on port 2.

Speed (%)Asked to passActually landed onOvershoot
3089
5089
10089

What is the relationship between speed and overshoot? Which speed will you use for turns, and why?

Step 2 — Correct for it

Subtract your overshoot from the target and run again. Keep adjusting until the robot lands on 90.

TryNumber in my hexagonWhere the angle actually landed
1
2
3

Step 3 — A left turn too

Copy the turn, flip the steering to −100, flip the hexagon to < −83 (your corrected number, negative). Run it.

Step 4 — The square, again — and this time it closes

In Project 5 you drove a square with four wheel-counted turns and it did not close. Do it again — same square, distances with move for rotations, but every corner turned by the gyro.

QuestionProject 5Now
How close to the starting spot?
Facing the same way?

This Is the Whole Point of the Project

Same robot. Same square. The only thing that changed is what the robot was measuring — and suddenly it can come back to where it started.

Your wheel-counted square drifted a little more with every corner. Why does a gyro-turned square not do that?

Step 5 — Drive a checked distance

One more trick with the wheel counter, so you have it when you need it. Reset the count, start moving, wait until A degrees counted passes your degrees-per-inch times 12, stop. That is a 12-inch drive built out of raw checking — the thing move for inches does for you.

I wantDegrees (inches × DPI)How far it really went
6 inches
12 inches

When would you build a drive this way instead of using a plain move for inches block? (Hint: what if you wanted to check two things at once while driving?)

Step 6 — Mission 9 Bonus — get Botguy out9 pts

Watch Mission 9 video

Bonus Mission

9 points Live judged

Botguy is outside the enclosure AND is touching the warehouse floor.

Scores

  • A robot is touching Botguy.
  • Botguy is completely outside the enclosure and touching the warehouse floor.
  • Botguy is touching the warehouse floor while being held by a robot.

Does Not Score

  • A robot is near Botguy but not touching him.
  • Botguy is touching the warehouse floor but still touching the enclosure.
  • Botguy is removed from the enclosure but not touching the warehouse floor.

Your claw can still be holding him. He just has to be clear of the enclosure and down on the floor at the same instant.

Step 7 — Mission 18 Base — take him to the loading zone11 pts

Watch Mission 18 video

Base Mission

11 points Final judged

Botguy is the Loading Zone.

Bonus Mission

13 points Final judged

Botguy is the Loading Zone AND at least one Traffic Cone is the Loading Zone.

Advanced Bonus

15 points Final judged

Botguy is the Loading Zone AND both Traffic Cones are the Loading Zone.

Scores

  • Botguy is the Loading Zone.
  • Botguy and one Traffic Cone are the Loading Zone.
  • Botguy and both Traffic Cones are the Loading Zone.

Does Not Score

  • Botguy is outside the Loading Zone.
  • Botguy is touching only the exterior boundary of the Loading Zone.
  • A Traffic Cone is the Loading Zone but Botguy is not.
  • Botguy and only one Traffic Cone are the Loading Zone for the Advanced Bonus.

One Trip, Two Missions, Twenty Points

You just lifted Botguy out of the enclosure for Mission 9. Do not put him down — carry him to the Loading Zone and Mission 18’s base scores too.

This is exactly the kind of thing to look for when you plan a full match: one action, more than one mission.

Mission 18 is final position, so Botguy has to still be when the match ends. Set him down properly and back straight away.

Roughly how many inches is it from the enclosure to the loading zone?

Step 8 — Mission 8 — deliver the red cube20 pts

Watch Mission 8 video

Base Mission

11 points Final judged

The pallet with the Large Red Cube is the Loading Dock.

Bonus Mission

9 points Final judged

One or more Small Red Cubes are the Large Red Cube while the pallet is on the Loading Dock.

Scores

  • The pallet and Large Red Cube are the Loading Dock.
  • One Small Red Cube is the Large Red Cube while on the Loading Dock.
  • Multiple Small Red Cubes are the Large Red Cube on the Loading Dock.

Does Not Score

  • The pallet is on the Loading Dock but the Large Red Cube has fallen off.
  • A Small Red Cube is on the Loading Dock but not the Large Red Cube.
  • The pallet is not touching the Loading Dock.
  • The Large Red Cube is on the Loading Dock without the pallet.

⚠ The Pallet and the Cube Travel Together

Read the failures carefully. The Large Red Cube on the Loading Dock without the pallet does not score. Neither does a pallet on the dock with the cube fallen off.

They both have to end up there, cube on pallet, pallet on dock.

Which was harder — driving to the dock, or getting the pallet onto it?

Step 9 — Run it five times

RunM9 bonusM18 baseM8 baseM8 bonusPoints
1
2
3
4
5

Score It — Checkpoint

My score

Mission partScored?Points
Mission 9 — Bonus (Botguy out and on the floor)9
Mission 18 — Base (Botguy in the Loading Zone)11
Mission 8 — Base (pallet + cube on the dock)11
Mission 8 — Bonus (small red cube on top up there)9
My total40

My measuring card

These join your motor card. Every precise move from here on uses them.

MeasurementValue
Degrees per inch
Turning speed I use
My turn overshoot at that speed
Hexagon number for a 90° right turn
Hexagon number for a 90° left turn
Inches from my starting box to the loading dock

Write the check

I want the robot to…The wait-until hexagon says
Spin right until it has turned past 45°
Spin left until it has turned past 90° the other way
Drive until the left wheel has rolled 8 inches, using my DPI

Can you do it again?

Think about it

Your battery is half flat, so the robot turns slower. What happens to a turn tuned by wheel degrees in Project 5? What happens to a turn that waits for the angle?

Wheel degrees tell you how far the wheels turned — not how far the robot moved. Name a situation where those two are different.

You have now built the reset-spin-wait-stop turn several times, in several projects. What would you rather do than keep rebuilding it?

Next

You have a robot that can measure. You also have a program that says the same twenty lines over and over.

In Project 12 — Teaching Your Robot New Moves, you give that whole stack a name — and then you just say the name.

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