DC motor controlled by distance sensor

I'm sorry if this is the wrong section, but I'm new to this and need some help . I only have experience with labview for controls. Does anyone have examples of code for controlling a motor with a distance sensor? Mine needs to basically speed up if someone is close and maintain 10 ft distance from someone. Thanks

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1287772766