Problem with stopping a servo with Sensor Value

You only posted a portion of your code.
Please post the entire sketch.