Blocks → logic → motion

Watch your blocks drive.

A clear 45-second walkthrough of the exact MakeCode logic behind a HuskyLens-guided m:bit car.

Real MakeCode blocksMbit + HuskyLensNo Robot extension
PROJECT FILM · 00:451080P · ENGLISH CC
The real project

Three steps from camera to wheels.

These are exported from the verified MakeCode workspace. The block shapes are never redrawn or approximated.

01 · Initialize

Start the camera

Connect HuskyLens over I2C, select object tracking, and set the target and safety thresholds once.

Start the camera MakeCode blocks
02 · Read

Request fresh data

The forever loop requests a new frame and reads the learned target’s ID, horizontal center, and width.

Request fresh data MakeCode blocks
03 · Decide

Choose one safe action

The order matters: verify the target, steer by X, stop when width exceeds 160, then run forward.

Choose one safe action MakeCode blocks
The decision order

One camera reading. Five visible actions.

The car follows the same branch order as the verified Python and Blocks project.

01ID ≠ 1

Target missing

No learned target means no movement.

CAR_STOP
02X < 120

Turn left

The target is left of the safe center zone.

CAR_LEFT
03X > 200

Turn right

The target is right of the safe center zone.

CAR_RIGHT
04Width > 160

Too close

A wide target is near, so the car brakes.

CAR_STOP
05120 ≤ X ≤ 200

Drive forward

The target is centered and still at a safe distance.

CAR_RUN
Checked in MakeCode

The environment matches the code.

Built as a summer-school exploration, the project uses pinned Mbit and HuskyLens extensions and keeps every original decision branch.

  • HuskyLens v2.0.7 with I2C object tracking
  • Yahboom Mbit car control APIs
  • Python → Blocks → Python round-trip verified
  • No Robot dependency and no grey Python blocks
Continue in MakeCode

Take the verified project with you.

Download the source or compiled HEX, then open the MakeCode editor to inspect, change, and test every branch.