10. Case 06 -Use Joystick:bit to Control the XGO#


10.1. Purpose#

Hello, in the first few lessons, we basically programmed the program first and then controlled the XGO movement, so we cannot control the XGO in real time. Then, in this lesson, we will realize the real-time control of the XGO through the remote control. Therefore, in this lesson, we will Implement Joystick:bit to control XGO to make actions. For related documents of joystick:bit, please refer to: Joystick:bit.

10.2. Materials#

1 × micro:bit XGO Robot Kit

1 × Joystick:bit

10.3. Working principle#

We use a data cable (USB cable) to connect the computer with the micro:bit


10.4. Software Platform#


10.5. MakeCode programming#

Step 1#

Click Advanced in MakeCode to see more options.


For programming, we need to add a package: click “Extensions” at the bottom of the MakeCode drawer, and search for “XGO” in the dialog to download.


Note: If you encounter a prompt that some codebases will be removed due to incompatibility, you can follow the prompt to continue or create a new project in the menu.

10.6. Code#


Program the Joystick:bit#


Program XGO#


Link: Joystick program

Or you can download it directly:

Link: XGO Program

Or you can download it directly:

10.7. FAQ#

If XGO doesn’t walk, check the power status of the XGO and the Joystick:bit.

10.8. Exploration#

Can we control the XGO with the C/D/E/F buttons on the Joysitck:bit?