Help with a pulse detection func

Im running the code below

No, you aren't. That code won't even compile. There are functions missing.

Defining a pin number, and then hoping that somehow, magically, data from that pin will be read and transformed into something useful is a waste of hoping. Save that for something more fun.