Read a freqency from an analog pin

What about turning the LEDs off?
What if the average is 5000?

Now ,it is correct?

You're the one with the hardware, you tell us.