Filtering PWM output

Dear all,

LiDAR is a useful sensor to detect distance between two objects. It outputs data very fast (500 readings per second).

Here is my PWM wiring illustration in LiDAR Lite Ver.2.

Here is the Histogram of Frequency distribution from the PWM output.

How can I keep strongest signals in every 0.5 second (i.e., every 250 readings)?

In this case, I want to just keep PWM output at 27 (or more frequent PWM signals).

How can I do this directly from the wiring as well as in the Arduino code?