9. Case 07: The Basketball Counter#

9.1. Purpose#

To make a basketball counter.


9.3. Materials Required#


Video link: https://youtu.be/0P88GP4RQaw

9.4. Bricks build-up#


















9.5. Installation Mthods of Hardwares#

Install the sonar:bit with the bricks.


9.6. Hardware Connection#

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


9.7. Software Platform#


9.8. Coding#

Add extensions#

Click “Advanced” in the MakeCode to see more choices.


Search with Wukong in the dialogue box to download it.


Search with https://github.com/elecfreaks/pxt-sonarbit 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.