analogRead messes up my frequency counter function

When you say nesting, are you referring to how I call test_Freq() from within a print command

No, I mean how you nest the two loops in "test_Freq".

Maybe it's late, but they don't look right to me.