For students brand new to MakeCode · Day 3 + Day 5 + every match

Launch Sequence
Quick Help

Your job: get your bot from where you start to where the ball is, in a straight line, fast. This page is for students who have never written a Cutebot program before. You will use both blocks and code — every block on this page has a code line right next to it so you can see they are the same thing in two different shapes. Save your sequence when you finish — you will reuse it on Day 5.

01

What is a launch sequence?

A launch sequence is a tiny program that runs once when you press Button A. It tells your bot:

  1. Cruise forward at constant power.
  2. Wait the exact number of milliseconds it takes to reach the ball.
  3. 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.

The math you already did — two conversions

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.

02

Open MakeCode

1
Open the project link your teacher shared. It opens MakeCode in your browser with the Cutebot Pro extension already installed.
2
If you want a fresh project instead, go to makecode.microbit.org, click New Project, then add the Cutebot Pro extension from Extensions → search "cutebot".
3
You will see two tabs at the top: Blocks and JavaScript. They are the same program in two views. You can switch any time — what you build on one side updates the other. Try clicking back and forth a few times to see.
03

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.

Blocks view
on button A pressed
↳ your code goes here
end

Find it under: Input → on button A pressed

JavaScript view
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.

Blocks view
CutebotPro · distance running Advance 121 Cm

Find it under: CutebotPro → distance running · drop your number into the middle slot.

JavaScript view
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.

Blocks view
CutebotPro · stop immediately ALL

Find it under: CutebotPro → stop immediately

JavaScript view
CutebotPro.stopImmediately(
    CutebotProMotors.ALL
)
04

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.

Blocks view — full program
on button A pressed
distance running Advance 121 Cm
stop immediately ALL
end
JavaScript view — full program
input.onButtonPressed(Button.A, function () {
    CutebotPro.distanceRunning(
        CutebotProOrientation.Advance,
        121,
        CutebotProDistanceUnits.Cm
    )
    CutebotPro.stopImmediately(CutebotProMotors.ALL)
})
Change ONE number The only number you change is the distance in cm. If your team picked the (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.
05

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.

JavaScript view
// 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.

JavaScript view
// 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)
Why this is longer The L-Path drives 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.

JavaScript view
// 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.

JavaScript view
// 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)
How to pick

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.

06

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.

1
Name your program. At the bottom of the MakeCode window, find the project name box. Type something specific like 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.
2
Get a share link. Click the Share button (top right). MakeCode generates a short URL that anyone can open to see exactly your program. Click Publish project, then copy the URL.
3
Paste the URL into your team's shared notes — your dashboard, your Drive folder, wherever the Analyst keeps things. Put the name next to it. "LAUNCH-V1 · (0,4)→(4,2) · 121 cm · SPEED 6 — https://makecode.microbit.org/S12345-..."
4
Save the .hex file too (optional but smart). The Download button gives you a .hex file. Keep it in your team folder. If the share link ever breaks, the file still works.
Why this matters on Day 5 On Day 5 you copy the full game code from your teacher. That code uses all four stat formulas to run actual matches. Your launch sequence — the first move that gets you to the ball — plugs into the start of the game program. If you saved it cleanly, that takes 30 seconds. If you didn't, you'll spend half of Day 5 re-deriving distances from your stat card.
07

Common mistakes — read these before you flash

⚠
Squares vs centimeters. The distance formula gives you grid squares. The Cutebot Pro block wants centimeters. Multiply your squares by 27. (Forgetting this is the most common Day 3 error.)
⚠
Adding instead of using the distance formula. The distance from (1, 1) to (4, 5) is not 3 + 4 = 7. It's √(3² + 4²) = √25 = 5. The shortcut feels right because it's smaller; the bot will land short.
⚠
Forgetting the brake. Always end with 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.
⚠
Programming time instead of distance. The block we want is 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.
⚠
Picking a complicated strategy when the straight shot would work. The L-Path and 45° Diagonal are options, not upgrades. If your distance formula gave you a clean number and the ball is directly between you and the goal, use the straight shot — it has the least to go wrong.
⚠
The bot lands a few cm short or long. That's expected — the formula doesn't account for friction, momentum, or the curve of the wheels. The Analyst logs the gap as a residual, then the team adjusts. This is not failure. It's data.
08

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.
09

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.