Infrared sensor

I am currently doing a project where I have to drop a load at one metre from the wall and the floor. To do this I am currently using infrared sensors. I have a basic code, which I found in a textbook. However, the code doesn't seem to work as it reads a reading even though the sensor is not connected?

PS: First post, so sorry if it is in the wrong sub section.
Chiraag

Well you give no code, but assuming you're doing either an analogRead or a digitalRead, you'll always get something from a pin