Case 12: Remote Control the Cutebot with micro:bit Accelerometer
Contents
16. Case 12: Remote Control the Cutebot with micro:bit Accelerometer#
16.1. Purpose#
Use the accelerometer in another micro:bit to remote control the Cutebot for the direction and speed.
Both of the micro:bit need to be programmed.
16.2. Materials#
1 x Cutebot Kit
1 x micro:bit
16.3. Software Platform#
16.4. Programming#
Step 1#
Click the “Advanced” to see more choices in the MakeCode drawer.
A codebase is required for Cutebot programming, click “Add Package” at the bottom of the drawer, search
Cutebot
in the dialogue box and download it.
Note: If you met a tip indicating incompatibility of the codebase, you can continue with the tips or build a new project there.
Step 2: Remote Control Programming#
Set “radio set group” to
1
in theOn start
brick.Set
x
whose value is given by “acceleration (mg) x” exactly divides10
to the radio value inforever
brick.Set
y
whose value is given by “acceleration (mg) y” exactly divides10
to the radio value inforever
brick.The scope of the acceleration value is
0
~1024
, which can be regarded roughly as the speed value in0
~100
after dividing10
.
Programming#
Links: https://makecode.microbit.org/_Pv01m2ehfcKT
You can also download it directly below:
Step 3: Cutebot Programming#
Set the “radio set group” to
1
in theOn start
brick. Items must be the same with the remote control for the correct match.Drag two “if” bricks into the
on radio received
brick and judge if the radio revived valuename
isx
ory
If the radio received value
name
isx
, it is the data forX
and then save thevalue
in the variablexValue
.If the radio received value
name
isy
, it is the data fory
and then save thevalue
in the variableyValue
.In
forever
brick, set the left wheel speed toyValue
+xValue
and right wheel speed toyValue
-xValue
.
Programming#
Links: https://makecode.microbit.org/_VYxbiCVtE962
You can also download it directly below: