Tweaked filtered analogRead function