Please edit your post to enclose the code in code tags, as instructed.
Also explain how you have wired the sensor.