When a clot goes along the Ping))), the ping))) wil activate a scanner and a light but this is impossible, we thought we better just count clots of they pass the ping)))
It's not impossible. But, you need to understand that the ping sensor is an analog sensor (something is x distance away), not a digital sensor (something is close).
So, your sensor is going to return values like 200, 200, 198, 190, 170, 150, 140, 130, 120, 100, 90, 80, 70, 60, 50, 40, 30, 20, 15, 15, 15, 15, 15, 18, 20, 30, 40, 50, 60...
If you decide that any value less than 50 means that something is being thrown away, then 40, 30, 20, 15, 15, 15, 15, 15, 18, 20, 30, and 40 will all mean that something is being thrown away.
If you increment the counter each time you get a reading less than 50, then you would increment the counter 12 times with the sample data I showed.
If you compare the current reading (40, for instance) with the previous reading (50), and increment the counter only when the current reading is less when 50 and the previous reading is not, then with the sample data I showed, the counter would only be incremented once.
If you can increment a counter, then you can do any other action, too, such as starting the scanner and light.
Perhaps now that you see how your sensor works, you can see when you could turn the scanner and light off, too. (The current reading is above the threshold and the previous reading is not.
I'm very happy to see you learning about computer programming at such an early age, if you really are only 12. Computers are not going away, and computer programmers will always be needed.
Look around on the playground, and find code to read your sensor. Start with doing nothing but printing the distance to the serial port. When you get that working, we can work on adding the additional code to increment the counter, if you need help with that. Or, perhaps I've given you enough clues that you can figure something out. If not, don't feel bad. We'll help.