Skip to main content

Case 07: The Basketball Counter

Purpose


To make a basketball counter.


micro:bit Wonder Building Kit

Materials Required


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

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


MakeCode

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.

Program

Link:https://makecode.microbit.org/_hueHXycJJgv1

Result

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.