Skip to main content

Case 23: The Locomotive

Purpose​


Make a locomotive.


micro:bit Wonder Building Kit

Materials Required​


Bricks build-up​


Hardware Connection​

Connect a motor to M1 port on Wukong breakout board.

Software Platform​


MakeCode

Coding​


Add extensions​

Click "Advanced" in the MakeCode to see more choices.

Search with Wukong in the dialogue box to download it.

Program​

Link:https://makecode.microbit.org/_5WjDde1jAF6R

Result​

When button A is pressed, the locomotive moves forward; when button B is pressed, the locomotive moves backward; when button A+B is pressed, the locomotive stops moving.