8. case 05 Remote Control#

8.1. Our Goal#

Use another micro:bit control our motor:bit car.

8.2. Material#

1 x motor:bit smart car kit

1 x micro:bit

8.3. Background Knowledge#

What is radio?#

Radio is the technology of using radio waves to carry information, such as sound, by systematically modulating properties of electromagnetic energy waves transmitted through space, such as their amplitude, frequency, phase, or pulse width. When radio waves strike an electrical conductor, the oscillating fields induce an alternating current in the conductor. The information in the waves can be extracted and transformed back into its original form.

8.4. Software#

Microsoft MakeCode

8.5. Programming#

Step 1#

Click Advanced in the code drawer of MakeCode to see more options.


To program for motor:bit, we have to add a package. Find Add Package in the bottom of code drawer and click it. This will pop up a dialogue box. Search for “motorbit” and then click to download this package.


Note: If you get a hint that some packages will be deleted due to the problem of incompatibility, you can either follow the prompts, or create a new project in the project menu.

Step 2#

Let’s start by coding our remote controller (i.e. our transmitter).
At the beginning, set radio group to 88.(Same group with the receiver.)
Press button A, radio send number 1.
Press button B, radio send number 2.


Step 3#

Now, let’s write the receiver program for our motor:bit car.
When start, set radio group to 88. (Same group with the transmitter.)
Make the car move forward by a default speed of 80.
When radio signal is received, assign the received number to variable item.
Create a loop to check the value of item. If it is 1, the car will turn left at the speed of 80 and delay time for 0.5s.
If it is 2, the car will turn right at the speed of 80 and delay time for 0.5s.
If not both of them, the car just move forward at the speed of 80.


8.6. Program#

Code of Remote Controller#

Link of the whole program: https://makecode.microbit.org/_5yyHJoJsjcH4

You can also download the program from the page below.

Code of Motor:bit Car#

Link of the whole program: https://makecode.microbit.org/_8Dp0WMEDwMad

You can also download the program from the page below.

8.7. Result#

Once powered on, the car moves forward at the speed of 80. Press button A on the remote controller, the car turns left. Press button B, the car turns right.

8.8. Think#

8.9. FAQ#

8.10. Relative Readings#