Autonomous Selection

I have seen teams with parts on their robot which can be used to select an autonomous program depending on which side of the field they are positioned at.

What is the part which can be used to do this, and how can we program it in our competition program?

There are several parts that could be used.

A potentiometer

or the LCD Display (if you can find a used one for sale somewhere)