Mini sumo code

Hi Im basically looking for some tips in compiling some code to control a robot so that it detects and follows another robot. I am using a Sharp IR 2Y0A21 sensor and am getting values ranging from 650 to 0. Basically what I want the arduino controlled robot to do is follow the high values. I am using a h-bridge and 2 DC motors to move the bot around. How can I have the sensor take reading at all times and the robot following another robot? Thanks

Hmmmmm.... I've never tried to make a robot follow another, but I'm not sure a proximity sensor is the way to go. It won't have anyway of distinguishing the followee from a wall.

There were threads late last year about using ultrasound, but I can't find them and I forget the details. It was something to do with the followee transmitting the ping, and the follower seeking that and homing in.

The only IR following things I've ever read about use a beacon: the followee needs to transmit a signal which the follower needs to hook up to.

To make a transmitter of any type work all the time, most seem to mount them on a servo so it can sweep side to side, judge where the object is, and instruct the stering accordingly.

Hi Thanks for the reply. Since the sensor has a range from 2cm to 80cm it only gives me a value of 0 when I point it a the ceiling. I do not want to mount the sensor on a servo, instead I would like the bot to turn around till the IR sensor returns a value of at least >100. I have tested the sensor on my desk and when I turn it around the room it gives me very low values. But as soon as I point it towards a book or a cup, on my desk, it gives me values >100. So I though all I need to do is set the FWD pins HIGH so that the bot will drive FWD while the sensor returns values over 100. Only part Im unsure of, is how to keep the bot following a moving target. Thanks so much for taking the time to reply at all! :)