Example Code for micro:bit-Read the sensor data from IO port
Last revision 2025/12/30
This article offers a guide to reading sensor data from a micro:bit's IO port using MakeCode, including sample code and instructions for library installation, demonstrating the program's output with button interactions.
Software Preparation
Motor drive library address: https://github.com/DFRobot/pxt-micro-IOBOX. About how to install the library?
Programming Platform: makecode graphical programming
Sample Code

Result
The effect of the program: press the button, the dot matrix shows "0", release the button, it displays "0".
Was this article helpful?
