Can't help with the connectivity problem.
Looking at the code, it's far too complicated. You are partially building an exor function using if statements (part of it shown below)
if (digitalRead(A_1Switch == HIGH) && (digitalRead(B_1Switch) == LOW))
{
digitalWrite(ledPinDS, HIGH); //For when A1 read 1 and B1 reads 0
}
if (digitalRead(A_1Switch == LOW) && (digitalRead(B_1Switch) == HIGH))
{
digitalWrite(ledPinDS, HIGH); //For when A1 read 0 and B1 reads 1
}
C has built-in functions for that.
The above also contains some errors with braces (e.g. if (digitalRead(A_1Switch == HIGH) ... should be if ((digitalRead(A_1Switch) == HIGH) ...
C code for exor / logical and / logical or
int exor = digitalRead(A_1Switch) ^ digitalRead(B_1Switch);
int and = digitalRead(A_1Switch) & digitalRead(B_1Switch);
int or = digitalRead(A_1Switch) | digitalRead(B_1Switch);
Based on this image of a 4-bit adder (not my picture hence a link) you can do something like
R1 = value_A1 ^ value_B1 ^ carry;
carry = ((value_A1 ^ value_B1) && carry) | (value_A1 & value_B1);
where R1 is the output of the output for A1 and B1 and carry is obviously the carry.
Below the full 4-bit adder (learn from it
)
void loop()
{
// carry 'bit'
int carry = 0;
// read and store the values of the buttons
int value_A1 = digitalRead(A_1Switch);
int value_A2 = digitalRead(A_2Switch);
int value_A3 = digitalRead(A_3Switch);
int value_A4 = digitalRead(A_4Switch);
int value_B1 = digitalRead(B _1Switch);
int value_B2 = digitalRead(B _2Switch);
int value_B3 = digitalRead(B _3Switch);
int value_B4 = digitalRead(B _4Switch);
// the result
int R1 = 0;
int R2 = 0;
int R3 = 0;
int R4 = 0;
R1 = value_A1 ^ value_B1 ^ carry;
carry = ((value_A1 ^ value_B1) && carry) | (value_A1 & value_B1);
Serial.print("A1 = "); Serial.print(value_A1);
Serial.print(", B1 = "); Serial.print(value_B1);
Serial.print(", R1 = "); Serial.print(R1);
Serial.print(", C = "); Serial.println(carry);
R2 = value_A2 ^ value_B2 ^ carry;
carry = ((value_A2 ^ value_B2) && carry) | (value_A2 & value_B2);
Serial.print("A2 = "); Serial.print(value_A2);
Serial.print(", B2 = "); Serial.print(value_B2);
Serial.print(", R2 = "); Serial.print(R2);
Serial.print(", C = "); Serial.println(carry);
R3 = value_A3 ^ value_B3 ^ carry;
carry = ((value_A3 ^ value_B3) && carry) | (value_A3 & value_B3);
Serial.print("A3 = "); Serial.print(value_A3);
Serial.print(", B3 = "); Serial.print(value_B3);
Serial.print(", R3 = "); Serial.print(R3);
Serial.print(", C = "); Serial.println(carry);
R4 = value_A4 ^ value_B4 ^ carry;
carry = ((value_A4 ^ value_B4) && carry) | (value_A4 & value_B4);
Serial.print("A4 = "); Serial.print(value_A4);
Serial.print(", B4 = "); Serial.print(value_B4);
Serial.print(", R4 = "); Serial.print(R4);
Serial.print(", C = "); Serial.println(carry);
}
I've used serial print statements, you can modify this to shift the bits out.
Note: I've used this so it more closely resembles a hardware implementation (as you were doing). You could simply add 2 numbers (based on your inputs), check if the 5th bit is set to detect the last carry, subtract 16 etc. But that would have been less fun.