Detecting varying PWM states

I am experimenting with this in a separate sketch and you're correct my code is a mess but I will clean it up and post it. I implemented an RC filter with 1uF cap and 56k resistor. I had to use a 100k pullup as the internal wasn't enough. This is what I got using analogRead. The signal has been significantly attenuated I guess I would need an op-amp if I wanted?