Welcome to Building:bit Superkit repository
1.2 Ultrasonic ranging
Ultrasonic ranging
Ultrasonic ranging1.Learning objectives2.Sensor Wiring3.programming3.1 Adding an Extension Pack3.2 Bricks used3.3 Combination building blocks4.Experimental phenomenon
1.Learning objectives
In this course, we mainly learn how to realize ultrasonic module ranging through MakeCode graphical programming.
2.Sensor Wiring
Ultrasonic connection is at P1P2 interface.

3.programming
Method 1: Online programming:
First, connect the micro:bit to the computer via a USB cable. A USB flash drive will pop up on the computer. Click the URL in the USB flash drive:https://makecode.microbit.org/ to enter the programming interface. Then, add the Yahboom software package https://github.com/YahboomTechnology/SuperBitLibV2 to start programming.
Method 2 Offline programming:
Open the offline programming software MakeCode and enter the programming interface. Click [New] and add the Yahboom software package https://github.com/YahboomTechnology/SuperBitLibV2 to start programming.
3.1 Adding an Extension Pack


3.2 Bricks used
The locations of the building blocks required for this programming are shown in the figure below.


3.3 Combination building blocks
The summary procedure is shown in the figure below.
You can also directly open the Ultrasonic-ranging.hex Drag the file into the browser that opens the URL, and the program diagram of the project source code will be automatically opened.
4.Experimental phenomenon
After the program runs successfully, the microbit dot matrix displays the distance measured by ultrasound.