In this application (sensing presence of an object), you'd be wise to use an integrated IR receiver. This is a 3 pin device that will output a logic signal when your object is present. It's exactly what's used to receive signals from a TV remote. These devices are very common, and very cheap. This willl eliminate all problems with ambient light. You will need to switch your LED on and off at about 40kHz. Neil -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist