Skip to main content

Case 07: The Basketball Counter


To make a basketball counter.

micro:bit Wonder Building Kit

Materials Required

Video link:

Bricks build-up

Installation Mthods of Hardwares

Install the sonar:bit with the bricks.

Hardware Connection

Connect a sonar:bit to P1 port on Wukong breakout board.

Software Platform



Add extensions

Click "Advanced" in the MakeCode to see more choices.

Search with Wukong in the dialogue box to download it.

Search with in the dialogue box to add the sonar:bit extension.




When the ultrasonic sensor detects the ball goes through the basket, it will be counted, and the value will be displayed on the micro:bit. (The principle of ultrasonic counting in this case requires to be tested according to the actual construction of the basket, it is the detection of ultrasonic sensors to the ball basket with the fixed distance value, and by judging this fixed distance value, the score plus one, so as to achieve the purpose of counting. (Ultrasonic sensor counting may have deviations, inaccurate, belonging to the normal situation of not detecting the small ball.