Re: Fequency out for use with IR sensors
There's a PlayTone command to create the output which is generated by hardware. It's a continuous square wave at the specified frequency. There is no way to synchronize this to an input signal.
For IR distance sensors you should look at the line of sensors made by Sharp. They come with various distance ranges.