I got a nice lesson in infrared optics, the necessity of reading a datasheet before using a product, and the concept of paranoia in a robot.
I've been adding sensors to my mini-sumo robot, Shallow Blue. I finally installed the last of them, a rear-facing Sharp IR proximity switch set to trigger at 40cm and closer. For now any time the sensor trips, the robot is set to spin around 180 degrees. So far so good.
I loaded the code, verified, plopped it in a ring, and turned it on. It immediately set to spinning around and wouldn't stop! Paranoia!
Of course it's simpler than that. The vertical spread of the beam was impinging on the floor, giving the sensor a reading closer than 40cm. It was doing exactly what it was told to do. I was able to verify this in a dimly lit room using an older CCD camera (Nikon 950), which could image the robot as well as the beam spot from the sensor. A quick modification to wedge the sensor at an angle to the floor solved the problem.