Base Mission
3 points Live judgedBoth Traffic Cones satisfy the definition.
Discovery · Coding Project 14
A sensor that answers with a number, not a yes.
Student PIN:
Your touch sensor answers one question: am I something? Yes or no. Nothing else.
This one is different. Plug the sensor — the little one, sometimes called a tophat — into an . Then open the Sensor List on the Wombat and watch the number while you hold it over things.
⚠ Hold It About a Quarter Inch Up
Pointed straight down, roughly 1/4 inch off the surface. the surface or held way up both give you useless numbers.
| Held over… | Reading |
|---|---|
| The white part of the game field | |
| A black line on the field | |
| Your desk | |
| Your hand | |
| Something dark you find in the room | |
| Something light you find in the room |
The sensor shines a tiny light down and measures how much bounces back. Use that to explain why the numbers came out the way they did.
There Is No "Black" Reading
You did not get a yes or a no. You got a number somewhere in a big range, and it drifts a little every time you look.
So you have to decide where black starts. The sensor will not do it for you.
Your numbers may not match anyone else’s. Different sensor, different mounting height, different room lighting.
A is the number you pick as the dividing line. Below it, call it white. Above it, call it black.
The usual starting point is halfway between your two readings:
threshold = (white + black) / 2
// For example: (800 + 3500) / 2 = 2150
That is a starting guess, not a final answer. You will adjust it.
| Code / part | What it means |
|---|---|
analog(1); | Gives you the number from the analog sensor in port 1. Compare it against your threshold to decide what the robot is looking at. |
The loop has not changed at all. Only the it watches.
Switch
In project 10, you watched a switch with two possible values.
while (digital(bump) == 0)
{
drive();
}Count
In project 11, you watched a motor position counter that climbed steadily.
while (gmpc(left) < 4000)
{
drive();
}Now, watch a brightness
Now, you are watching a brightness number that jumps around.
while (analog(line) < threshold)
{
drive();
}Read the new one out loud: “While the sensor is seeing something lighter than my threshold, keep driving. The moment it sees something darker, stop.”
When It Does Not Work, Move the Threshold
Stops too early, before reaching black? Your threshold is too low. Move it up, toward your black value.
Drives straight over the line and keeps going? Your threshold is too high. Move it down, toward your white value.
Also check the position of the sensor: is the sensor pointed straight down, about a quarter inch off the surface?
The light sensor does one job, and it is the job every Botball robot needs: it waits for the lights to come on, then starts the match.
// Wait for light on port 3, then continue
wait_for_light(3);Fix the reflectance sensor to the front underside of your robot, pointing straight down, about 1/4 inch clear of the mat. Then take fresh readings from the mounted position — they will not match what you got holding it in your hand.
| Measurement | Value |
|---|---|
| Analog port I used | |
| White reading, mounted | |
| Black reading, mounted | |
| My threshold — (white + black) / 2 |
Create a new project called Find the Line. Drive forward until the sensor sees black, then stop.
// 1. Print "Looking for the black line"
// 2. While the sensor reads less than my threshold, drive forward
// 3. Fall out of the loop when it reads more than the threshold
// 4. Stop everything
Use for your motors and your threshold — you have known better than bare numbers since Project 9.
| Try | Threshold | What happened |
|---|---|---|
| 1 | ||
| 2 | ||
| 3 |
The real test of a threshold is whether it works when you did not tune it for that exact spot.
Set your robot at three different distances from a line and run the same program each time, changing nothing.
| Starting distance | Did it stop on the line? |
|---|---|
This Is Something Ticks Cannot Do
A count only works from a known starting point. This program finds the line from anywhere — it does not care where it began.
Now do it twice in a row. Drive forward to a line, stop, then reverse until you find a line again.
⚠ Think Before You Write This One
When the robot stops, it is sitting on black. If you immediately start a loop that says “back up while you see white,” what does the sensor see on the very first check?
What did you have to do to get off the first line before looking for the next one?
Add wait_for_light() to the top of a program and follow the calibration routine on the Wombat’s screen.
Now your robot sits still until someone shines a light at it.
Why would every robot at a tournament need to start this way, rather than someone pressing a button on each one?
Mission 14 Both Traffic Cones satisfy the definition. A Traffic Cone is the Loading Zone. The Base Mission must be satisfied to score the Bonus Mission.Traffic Control
Watch Mission 14 video
Base Mission
3 points
Live judgedBonus Mission
7 points
Final judgedScores
Does Not Score
⚠ The Base Still Has to Hold
You cannot score this bonus unless both cones are the black line — including the one you left behind. If your second cone drifted back onto the line, the bonus is worth nothing.
Use your line-finding program to drive to the Loading Zone , then place the cone.
Mission 18 Botguy is the Loading Zone. Botguy is the Loading Zone AND at least one Traffic Cone is the Loading Zone. Botguy is the Loading Zone AND both Traffic Cones are the Loading Zone.Safety First, All Hands on Deck
Watch Mission 18 video
Base Mission
11 points
Final judgedBonus Mission
13 points
Final judgedAdvanced Bonus
15 points
Final judgedScores
Does Not Score
⚠ and Are Not the Same Thing
Mission 14’s bonus only needs a cone the zone — any part of it poking into the interior counts.
Mission 18 needs the cones — every single part inside, nothing touching or crossing the boundary.
A cone half over the line scores Mission 14 and nothing from Mission 18. This is exactly why you need the sensor: it tells you where the boundary actually is.
One Delivery, Three Scores
Put Botguy and both cones fully inside the Loading Zone and you collect Mission 14’s bonus, Mission 18’s bonus, and Mission 18’s advanced — 35 points from one trip pattern.
Every part of this is final position, so nothing may drift out before the match ends.
Which order will you deliver them in, and why that order?
| Run | M14 bonus | M18 bonus | M18 advanced | Points |
|---|---|---|---|---|
| 1 | ||||
| 2 | ||||
| 3 | ||||
| 4 | ||||
| 5 |
| Mission part | Scored? | Points |
|---|---|---|
| Mission 14 — Bonus (a cone the Loading Zone) | 7 | |
| Mission 18 — Bonus (Botguy + one cone ) | 13 | |
| Mission 18 — Advanced (Botguy + both cones ) | 15 | |
| My total | 35 |
| Measurement | Value |
|---|---|
| Reflectance sensor analog port | |
| White reading | |
| Black reading | |
| Threshold I actually use | |
| Light sensor port |
Say whether each one satisfies , , both, or neither.
| The cone is… | Which definition? |
|---|---|
| Sitting well inside the zone, nothing near the edge | |
| Mostly inside, with its base edge resting on the boundary line | |
| Just its tip poking over the boundary into the zone | |
| Right beside the zone, touching the outside of the line |
| The robot… | Move the threshold which way? |
|---|---|
| Stops before it reaches the black line | |
| Drives over the line and keeps going | |
| Stops in a different place each run |
Your threshold works perfectly in your classroom. The tournament room has huge windows and much brighter light. What might happen, and what would you do about it on the day?
Your robot now has three ways to know where it is: bumping something, counting ticks, and reading brightness. Which one would you trust most, and does the answer change depending on the job?
Right now the sensor only tells your robot to stop. What if it kept reading while driving, and steered based on what it saw?
That last question is the whole of the next project. In Project 15 — Following the Line, the sensor stops being a stop sign and becomes a steering wheel.
KIPR · Botball Explorer — Discovery Projects · © KISS Institute for Practical Robotics 1997–2026
When you are finished, press the button to turn in your work and save a copy.
KIPR · Botball Explorer · Discovery