How to use a transistor with arduino

Dont increment pulsesdetected every time you see input LOW, just whenever input changes from HIGH to LOW.