Example Code for Infrared Remote Control

Last revision 2026/01/20

This article demonstrates how to use infrared remote control with Maqueen Plus V3 robot by decoding IR signals and mapping them to actions like moving and turning. It includes example codes for reading remote signals and controlling the robot, facilitating custom programming and enhancing user interaction with robots.

Introduction

The Maqueen Plus V3 features a built-in infrared (IR) receiver connected to micro:bit pin P16, enabling it to receive signals from a standard IR remote controller. By decoding the unique numeric value of each key press, the robot can execute different actions—such as moving forward, turning, or stopping—allowing full remote control functionality.

Note:
The Maqueen Plus V3 does not include an infrared remote controller by default. To use this feature, please contact sales to purchase the compatible remote separately.

The IR receiver is located on the front of the robot, as shown below:

IR sensor location

Each key on the remote corresponds to a specific decimal value. Reference the key-value mapping below:

IR remote key-value table


Example 1: Read the Value of the Infrared Remote Controller

Introduction

This example reads incoming IR signals and displays the decimal key value on the serial monitor. It helps users identify which number corresponds to each button on their remote, facilitating custom programming.

Hardware Preparation

  • Maqueen Plus V3
  • Compatible infrared remote controller (purchased separately)
  • micro:bit
  • USB cable

Software Preparation

Wiring Diagram

All components are integrated; ensure the remote is pointed directly at the IR receiver during testing.

Sample Code

View on MakeCode

Program Logic:

  • Continuously listen for IR signals on P16
  • When a signal is received, send its decimal value to the serial output

Result

  1. Point the remote at the IR sensor and press any key:
    Press remote key

  2. Click the serial data button in MakeCode to open the display panel:
    Open serial monitor

  3. Press different keys—their corresponding values appear in real time:
    Serial output of key values

This step is essential for mapping controls before implementing custom remote functions.


Example 2: Infrared Remote Control of the Car

Introduction

This example implements basic remote-controlled driving using the IR remote:

  • Forward, left turn, right turn, and stop commands are triggered by specific keys.
  • The program uses the known key values (from the reference table) to map actions.

Hardware Preparation

  • Maqueen Plus V3
  • Infrared remote controller
  • micro:bit
  • USB cable

Software Preparation

  • MakeCode with Maqueen Plus V3 extension

Wiring Diagram

No external wiring needed—all IR reception is handled onboard.

Sample Code

View on MakeCode

(Adjust key values in code if using a different remote model.)

Result

The robot responds instantly to remote commands, enabling intuitive manual control for demonstrations, games, or teleoperation tasks.

Was this article helpful?

TOP