8. Case 04-A Sound-controlled XGO Dog#

8.1. Purpose#

Hello, sometimes when we hear beautiful music, we will dance to the rhythm of the music, so the same is true of our good friend XGO, this lesson we use the micro:bit with its own microphone Come and feel the changes in the surrounding sounds so that XGO can dance “happily”, then let’s start.

8.2. Quick to Start#

Materials#

micro:bit XGO Robot Kit × 1

micro:bit × 1

Working principle#

  1. The micro:bit has a built-in microphone sensor. It can detect the volume of the surrounding sound, so as to make different reactions according to different volumes!

  2. The program we programmed is that XGO makes different actions according to the level of the surrounding sound.

Hardware Connections#


We use a data cable (USB cable) to connect the computer with the micro:bit, I believe you are already very skilled.

../../_images/microbit-xgo-robot-kit-22.png

8.3. MakeCode programming#


Step 1#

Click Advanced in MakeCode to see more options.

../../_images/microbit-xgo-robot-kit-10.png

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.

../../_images/microbit-xgo-robot-kit-11.png

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.

Step 2#

sample program#

../../_images/xgo-4-2.png

Link: A Light-controlled Dog

You can also download it directly below:

8.4. FAQ#

If XGO doesn’t move, please try adjusting the light intensity.

8.5. Exploration#

How to give more commands to XGO with light intensity?