Why don't you mount the emitter and receiver to your robot? that way you could use the PWM output of your Pic to pulse the IR emitter at 38khz and connect the output of the detector to any available (digital) input pin, then use an If/Then statment to poll the detector pin, in this case the pin would be low as long as there was a wall, and go high when it came to an opening. If there are other openings before the one you want to go into, you could have the pin increment a counter each time it went high, and when it got to the one you wanted, it would jump to a turn subroutine.
Dave




Bookmarks