I am using a TSOP 38238 which has a carrier frequency of 38khz. Using tone, I blink my IR diodes at that frequency.
int irBounce(int pinNo)
{
tone(pinNo, 38000, 1);
//interpret the signal
delay(1);
return (analogRead(A2)); //the higher this number is, the closer the object.
}
When call this function using the Serial.println(irBounce(pinNo)); I get odd results such as 1023 when there is nothing around, or 500 when my hand is right next to the diode.
If you look at the datasheet (http://www.vishay.com/docs/82491/tsop382.pdf) you will see that the TSOP38238 output is digital (LOW-HIGH), not analog. It will either detect the signal (1023) or not (0). Any value you get between those two probably come by reading the input pin as it is switching ON or OFF.