What is a launch sequence?
A launch sequence is a tiny program that runs once when you press Button A. It tells your bot:
- Cruise forward at constant power.
- Wait the exact number of milliseconds it takes to reach the ball.
- Stop.
That is the whole thing for now. No turning. No sensors. Straight line, exact time, stop. The hard part is not the code — the hard part is knowing the right number of milliseconds. That takes two conversions: coordinates to centimeters, then centimeters to milliseconds at your team's current SPEED.
1. Coordinates → centimeters. Your starting corner is at (x₁, y₁). The ball is at (4, 2) — dead center of the 8×4 arena. The straight-line distance is d = √((x₂ − x₁)² + (y₂ − y₁)²) — your grid squares. Multiply by 27 to convert squares → centimeters.
2. Centimeters → milliseconds. The bot cruises at a constant PWM for whatever time you tell it. You need your bot's calibration: how many ms per cm at your current SPEED. Look it up in your Day 1 Speed Stat Challenge notes. (At SPEED 6, Team Patience's bot takes about 33 ms per cm.) Multiply: cm × ms/cm = ms. That is the number you put in your program.
Open MakeCode
The three blocks you need
A launch sequence only uses three things. Here is each one in blocks view on the left and code view on the right.
A · "on button A pressed" — the wrapper
Everything you write goes inside this block. When the user presses Button A on the micro:bit, the code inside runs once.
Find it under: Input → on button A pressed
input.onButtonPressed(Button.A, function () {
// your code goes here
})
B · "distance running" — the drive
This is the block that does the actual driving. You tell it a direction (Advance = forward) and a distance in cm (the number you computed from Step 1 of the math). The block internally figures out how many ms it needs to run the motors at your current Speed — but it's worth running Step 2 of the math yourself so you know what time your bot is actually working with.
Find it under: CutebotPro → distance running · drop your number into the middle slot.
CutebotPro.distanceRunning(
CutebotProOrientation.Advance,
121,
CutebotProDistanceUnits.Cm
)
C · "stop immediately" — the brake
This makes sure the motors stop. The drive block usually stops on its own, but adding the brake is a safety habit. Always end with it.
Find it under: CutebotPro → stop immediately
CutebotPro.stopImmediately(
CutebotProMotors.ALL
)
The whole launch sequence — start to finish
Stack the three blocks. That's it. Here's a full launch sequence that drives the bot 121 cm forward and stops — the exact program Team Patience used to launch from corner (0, 4) toward the ball at (4, 2) on Day 3.
input.onButtonPressed(Button.A, function () {
CutebotPro.distanceRunning(
CutebotProOrientation.Advance,
121,
CutebotProDistanceUnits.Cm
)
CutebotPro.stopImmediately(CutebotProMotors.ALL)
})
(8, 0) corner instead, the distance is the same (121 cm — the ball at center is equidistant from both corners). But you should still run the distance formula yourself to confirm, and run the ms conversion at your team's SPEED so you know how long your bot will actually be cruising.
Other launch strategies — when the straight shot isn't the best move
The straight shot in Section 04 is the default — and the cleanest math. But the ball isn't always dead ahead of where you start, and the diagonal isn't always the fastest path. Here are four more launch strategies your team can pick from. Each one is a different path from your starting corner to the ball. Pick the one that fits your team's situation, then do the math for your numbers.
A · Straight Shot ⭐ Easy
What you already built. The bot drives in a straight line from your corner to the ball. Best when the ball is directly between your starting position and the goal — or when you trust the distance formula and just want the shortest path.
// Distance: 121 cm (from (0,4) to (4,2))
CutebotPro.distanceRunning(
CutebotProOrientation.Advance,
121,
CutebotProDistanceUnits.Cm
)
CutebotPro.stopImmediately(CutebotProMotors.ALL)
B · L-Path ⭐⭐ Medium
Two straight segments at a right angle. Drive forward, turn 90°, drive sideways. The math is easier than the diagonal — no square roots, no angle calculation — but you drive a longer total distance. Best when your team is more comfortable with right angles than with the distance formula, or when you want a defensive line that hugs the side of the field.
// Leg 1: forward toward the ball's row
// From (0, 4) to (0, 2): 2 squares × 27 = 54 cm
CutebotPro.distanceRunning(
CutebotProOrientation.Advance, 54, CutebotProDistanceUnits.Cm
)
// Turn 90° to face the ball
CutebotPro.trolleySteering(CutebotProTurn.RightInPlace, 90)
// Leg 2: sideways to the ball
// From (0, 2) to (4, 2): 4 squares × 27 = 108 cm
CutebotPro.distanceRunning(
CutebotProOrientation.Advance, 108, CutebotProDistanceUnits.Cm
)
CutebotPro.stopImmediately(CutebotProMotors.ALL)
54 + 108 = 162 cm total. The straight shot drives 121 cm. That's a 41 cm difference — about a 34% longer trip. The diagonal beats two straight legs every time (this is called the triangle inequality: a + b > √(a² + b²) always). But the L-Path is simpler to program, and sometimes simpler wins.
C · Sniper Hold ⭐ Easy
A tiny nudge forward, then let the bot's built-in sensors find the ball and kick it. Best for your team's first match — it's the baseline to compare every other strategy against. If a clever launch doesn't beat the sniper hold, the clever launch isn't actually working.
// Short nudge forward; the locked game code
// will find and kick the ball.
CutebotPro.distanceRunning(
CutebotProOrientation.Advance, 27, CutebotProDistanceUnits.Cm
)
CutebotPro.stopImmediately(CutebotProMotors.ALL)
D · The 45° Diagonal ⭐⭐ Medium
Turn 45° toward the ball, drive the diagonal, then turn back 45° to face the goal. Works perfectly when your forward and sideways distances are equal (a = b). The math is just hypotenuse = a × √2 ≈ a × 1.41. Doesn't apply to the (0,4) → (4,2) setup (where the legs aren't equal), but if your team chooses a different starting position where they are, this is the cleanest diagonal.
// Example: ball is 2 squares forward AND 2 squares right
// (equal legs: a = b = 54 cm)
// diagonal = 54 × 1.41 ≈ 76 cm
CutebotPro.trolleySteering(CutebotProTurn.RightInPlace, 45)
CutebotPro.distanceRunning(
CutebotProOrientation.Advance, 76, CutebotProDistanceUnits.Cm
)
CutebotPro.trolleySteering(CutebotProTurn.LeftInPlace, 45)
CutebotPro.stopImmediately(CutebotProMotors.ALL)
No single strategy wins every match. Compare three of them with your team by running each one three times from the same corner and recording the result (did it score? how long did it take?). The strategy with the best average — not the best best — is the one to commit to.
Match-time matters too. A 1.2 s strategy that fails 3 of 10 runs has a worse expected time than a 1.8 s strategy that succeeds 10 of 10. Reliability beats speed.
Save your launch sequence — you will reuse it on Day 5
Once your launch sequence works (drives close to the ball, stops cleanly), save it. On Day 5, when you set up your Simulation Matches, you will copy your saved launch sequence into the full game program. If you don't save it, you'll have to recompute the distance and re-program from scratch.
LAUNCH-V1 · (0,4)→(4,2) · 121 cm · SPEED 6 — include your starting corner, ball position, distance, and SPEED setting. Your future self will thank you..hex file. Keep it in your team folder. If the share link ever breaks, the file still works.Common mistakes — read these before you flash
√(3² + 4²) = √25 = 5. The shortcut feels right because it's smaller; the bot will land short.stopImmediately(ALL). The bot usually stops at the end of distance running, but sometimes it coasts a few cm if the brake isn't there.distanceRunning — drive an exact distance and stop. Not pwmCruiseControl alone (which is "drive at X speed forever") and not distanceRunning with the units set to ms (the third slot has to be Cm). The ms math you did is for understanding — the block still takes cm.Pre-flash checklist
Before you press download, run this check. If any line below is no, fix it first.
Before flashing
- My program has on button A pressed as the only event block.
- Inside it, I have distance running · Advance · <my number> · Cm.
- Followed by stop immediately · ALL.
- My distance number is in cm, not grid squares. (Multiply squares × 27.)
- I named the project something specific (start corner, ball position, distance).
- I clicked Share → Publish and copied the URL into my team's notes.
- The micro:bit is plugged in and shows as a drive (or paired via WebUSB).
- The arena is taped out and Patience is at our starting corner pointed at the ball.
What you'll do with this on Day 5
On Day 5 (the first day of Week 2), your team copies the full Velocity Arena game program from the teacher. That program already has all four formulas (motor power, decay, charge, turn ratio) wired into match behavior. Your launch sequence plugs in at the start.
The Coder for Week 2 opens the saved share link, copies the three lines of your launch sequence, and pastes them into the on start section of the game code. Match begins → launch sequence runs → bot reaches the ball area → the game program takes over from there.
If you saved your sequence cleanly today, that whole transfer takes about 30 seconds. Today's launch sequence becomes Monday's first move.