Basketball system using Ultrasonic Sensor with 4 digit 7 segment LED

Hi everyone. I’m new here and I’m having some problems with this project I am working on. The main problem is the code.

So I am trying to make a basketball system that uses the ultrasonic sensor to track the ball movement and make a score. I then want to have the score displayed on a 4 digit 7 segment LED display.

I have both the ultrasonic sensor and the 7 segment LED display set up but having problems with the code.

How would I code this kind of system.

I want it so that went the basketball is less than 10 centimetres away from the sensor it registers a point.

I’ve tries looking everywhere online and can’t find anything that’s helpful.

Would appreciate any kind of help! Thank you