What Alain said is to use a timer in your micro.

Start the timer when the signal appeared,and have the timer timeout after the period of the signal. I supose is about 4-5 seconds where you live too.

Of course the timer itself in the controller counts too fast, so you will need a variable along with it and increment it.

Here DT-INTS is finding a good use I guess.

Ioannis