Example Code for micro:bit-Read Specified Point Distance in Matrix Mode
- This example will demonstrate reading data from the left and right points and printing it on the computer.
Hardware Preparation
- MBT0039: micro:bit Main Board *1
- DFR1231: IO Extender for UNIHIKER K10 / micro:bit *1
- SEN0628: Matrix LiDAR Sensor *1
Software Preparation
- MakeCode Programming Platform Link: https://makecode.microbit.org/
- Library Address: https://github.com/DFRobot/pxt-DFRobot_matrixLidarDistanceSensor
Wiring Diagram

Other Preparation Work
- Load the library via the extension feature in MakeCode
Sample Code

Result

Additional Information
- In MakeCode, there are two modes: Matrix Mode and Obstacle Avoidance Mode.
- Matrix Mode: By selecting different I2C addresses, it supports cascading up to 4 sensors for simultaneous use.
- Obstacle Avoidance Mode: This is a test function intended solely for testing purposes. It may contain bugs or have limitations in user experience.
Was this article helpful?
