Example Code for micro:bit-Addition Operation

Last revision 2025/12/24

This article offers a detailed guide on executing addition operations using the micro:bit and Makecode platform, focusing on hardware and software setup, code implementation, and result display on the micro:bit LED matrix.

Hardware Preparation

  • Math & Automatic expansion board for micro:bit, Quantity: 1
  • micro:bit, Quantity: 1

Software Preparation

Makecode graphical programming, Mind+ platform.
Makecode Library Address.
About how to install a software library?

Wiring Diagram

No specific wiring required.

Other Preparation Work

Install the Makecode library from https://github.com/DFRobot/pxt-Math-Automatic.
About how to install a software library?

Sample Code

Addition Operation
Addition Opeation Example Code Download

Result

Generate random A and B within 0~50. Then the micro:bit LED matrix displays A+B for once. Players have to input the correct answer in 10 seconds. If the input answer is right, micro:bit displays "√", if it is not or timeout, display "×".

Was this article helpful?

TOP