Skip to main content

Case 06 -Use Joystick:bit to Control the XGO

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.

Materials

1 × micro:bit XGO Robot Kit

1 × Joystick:bit

Working principle

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

Software Platform

Makecode

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.

Code

samples:

Program the Joystick:bit

Program XGO

Link: Joystick program

Or you can download it directly:

Link: XGO Program

Or you can download it directly:

FAQ

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

Exploration

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