I'm working on my first robot, and I'm having trouble getting my Sharp IR range finder (GP2Y0A02YK) working. Any help would be greatly appreciated. The problem is the sensor seems to be working great, and I'm getting good readings when it's pointed at something. However, when i point it at "nothing" or cover up the sensor, I start getting random readings hovering around 250 instead of 0. So when the sensor should see nothing, it returns values. I'm using an ATmega128 chip on a robostix board. Does anyone have any ideas for fixing this? I just plugged sensor directly to input, ground, and vcc with external circuitry. I'm pretty sure the ADC is working, I can post the code if it would help. It seems to work fine as long as it's not pointed at infinity.