Facing problems with sketch for lap counting of slotcar track

I've been racing my analogue slotcar track with PC Lap Counter interfaced by Arduino. The sketch I use sends pulses to the software for lap counting. The problem is: when the car stay on the sensor, multiple pulses are sent instead of just 1 pulse. How can I solve this? Thanks.

Helo and welcome,

Maybe this will help: https://www.arduino.cc/en/Tutorial/StateChangeDetection

If you want more help, you need to show your code ;)

Thank you a lot guix! It works perfectly! I just added to my code what I learned from the link you suggested and... solved! Thank you again. Best regards!