Just thought of another way to do what you are after last night. Put 1K resistors between each of the pins, with the last connected to ground and the last on the other end connected to +5V. Then take the common and connect it to an analogue input and read the voltage.
This is a great technique. Only one pin required regardless of the number of stops. Here's a C++ fragment to decode the analog pin value into an integer switch stop number without the need for calibration or hardcoding stop values
void setup(int analogPin_,int numberOfStops_);
void RotarySwitchImpl::setup(int analogPin_,int numberOfStops_)
if(i==0 || diff<nearestDiff)