Proximity sensor issue

I have a question that I have not been able to resolve. I am creating an application with the proximity sensor and I would like that when such a value reaches a number, the proximity sensor pauses and does not continue counting.

1 Like

perhaps something like this?
(note: you'll need to put the if-else block in a relevant event block)
image