Coding Ireland STEM Report 2024 Have Your Say
Microbit Robotics
60 mins
345 points
What you need:
  • Computer/laptop
  • Microbit
  • Move Motor Car

Tilt Remote Control Car

In this project we use the accelerometer and the radio in one Microbit to control the Move Motor car by tilting the Microbit in different directions.

1 - Introduction

The aim of this project is to control the Move Motor car by using another Microbit as a remote controller. When you tilt the remote control Microbit in a direction it will send a message to the Microbit in the car which will make it move in that direction.

You will need the following for this project:

  1. 2 Microbits (1 that goes in the car and 1 for the remote control).
  2. A Move Motor car.

2 - Program the remote

We will need to create 2 code projects:

  1. for the Microbit that will be used as the remote control.
  2. and another for the Microbit that will be inside the car.

Let's create the code for the remote control first. Go to the website and create a new project. Call it "Remote Control" or something that let's you know that it's the project for the remote control.

Once you've created the new project, add the following code to set the radio group to 1. We will do the same later on the for the car project.

If this project is being done in a classroom with multiple cars then make sure each remote and car set uses a different radio group. Otherwise the signals will get crossed!

3 - Send message 'forward'

We are going to use the accelerometer sensor that's in the Microbit to detect when it is tilted forwards and when it is, we will send a message using the radio transceiver. We will also show an arrow point up on the Microbit so we have some visual feedback that this code has triggered.

Add the following code.

input.onGesture(Gesture.LogoDown, function () {

4 - Send messages 'left', 'right' & 'reverse'

Now in a similar way add the following code to detect when the Microbit tilts left, right and back and then send the appropriate message and show an arrow.

Add the following code.

input.onGesture(Gesture.TiltLeft, function () {

input.onGesture(Gesture.TiltRight, function () {

input.onGesture(Gesture.LogoUp, function () {

5 - Send message 'stop'

We also need to be able to stop the car so we need to program a gesture to send a 'stop' message as well.

Add the following code.

input.onGesture(Gesture.ScreenUp, function () {

Join our club 😃

To view the remaining 8 steps and access hundreds of other coding projects please login or create an account.

Copyright Notice
This lesson is copyright of Coding Ireland. Unauthorised use, copying or distribution is not allowed.
🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more