IR sensor (proximity sensor)

Hey guys !

I'm new to Arduino and I have some few questions about an IR sensor (proximity sensor) projet.

I just bought this :

I would like to know if it's possible to create a counter that would count +1 everytime the output signal is LOW and display the value of the counter on a LCD screen? Do you have any references about this?

Thank you !

while (digitalRead(yourpinnumber)) ; // waits for pin to go low
counter ++ ;  // add one
//display counter
while (!digitalRead(yourpinnumber)) ; // wait for pin to go high

Thank you so much !