My arduino digital input 2 defined as the LSB reads a correct 1 when 5V is applied to it and 0 when no voltage is applied. When the shield is added, it reads a 3 regardless if 0V or 5V is applied to the digital input LSB. Below is the code. The circuit is a wire from 5V to Digital Pin 2.
/Create and Define Global Variables
int dipPins = {5, 4, 3, 2}; // DIP Switch Pins
int Address;
void setup()
{
Serial.begin(9600);
int i;
for(i = 0; i<=3; i++){
pinMode(dipPins*, INPUT); // set the digital pins (defined above) as input*
//digitalWrite(dipPins, HIGH); // set internal pullup resistor on
}
}
void loop()
{
Address = address();
Serial.println(Address);
delay(1000);
}
//Read state from DIP Switch (4 positions used)
byte address(){
int i,j=0;
//Get the switches state
for(i=0; i<=3; i++){
j = (j << 1) | digitalRead(dipPins); // read each input pin
}
return j; //return address
}