Many microswitch designs actually have one common terminal, and both a NO terminal and a NC terminal. If you have a switch that has three terminals, chances are this is the arrangement. The wiring diagram for a switch is very easy. I recommend using a NO switch to limit the amount of power consumed. With a 10k pull-up, the amount of current is small, but many switches can add up to some noticeable power.
Important points are to use a pull-up resistor that doubles as a current limiting resistor.
In the event that your program accidentally switches the input port to an output port, having the current limiting resistor will keep from frying your Microcontroller. Infrared Detectors Infra-red detection is a common thing to add to a robot. It allows the robot to determine when it has come in close proximity to an object without coming into physical contact. A typical way of detecting infra-red is to use a Sharp G1U52X module. To learn more about this, check out Implementing Infrared Object Detection .