Example Code for micro:bit-Read Infrared Key Assignments

- Learning Target: Learn to read the key assignments of infrared, so that later can be flexible use of these data. - Effect: Press any key on the IR remote controller, the key value that corresponds to the pressed key will be displayed on the LED matrix (show the last two digits of key value in decimal).

Hardware Preparation

  • Maqueen Lite-micro:bit Educational Programming Robot Platform x 1 (ROB0148)
  • micro:bit board x 1
  • IR Remote Controller x 1

Software Preparation

  1. Makecode graphical online programming platform: makecode.microbit.org
  2. Maqueen library: Search for "dfrobot" in makecode extension and select "maqueen".

Wiring Diagram

No additional wiring required. The infrared receiver is integrated with Maqueen.

Other Preparation Work

Ensure the IR remote controller has working batteries.

Sample Code

Screenshot of Makecode Graphical Program:


Makecode Program Link: https://makecode.microbit.org/_UV9W1vRPP4tW

Result

Read Infrared Key Assignments

Additional Information

IR Remote Control and Its Key Assignments

The key assignments in the following table are in hexadecimal. In this product, we read the last two digits of the key assignments and automatically convert them to decimal data.


Was this article helpful?

TOP