danieljay:
PaulS: to clarify, when i read the sensor data through the serial monitor, it freezes when the if statements are met.
What do you define as "freezes"?
As pointed out, when your if-statements are met, you have 500ms of delays (50 times through the loop, 10ms at a time). During that time, your Arduino is effectively frozen (in a loop).
danieljay:
in addition, the numbers fluctuate from extremes from 34 to 5 to 1 to 17 (those are random numbers to clarify, just giving an example oh how much fluctuation there is). sorry for the confusion.
As Paul points out, this may be a seperate issue. So isolate it. Take out your fading code. Since your code to read the Ping sensor is (exactly?) the same as the example Arduino code, one would expect it to work stand alone. If it works by itself then you know it is related to your fading code.