Logic Gate tester need help for program

I am working on logic gate tester for 74LS series. for AND,NAND,OR,EX-OR. for IC all inputs (8 inputs) receive 00,01,10,11 and output of each signal goes to arduino to compare. output1 to output4 if equalls program works and checks the condition. However, gatevalue shows 0 allways.

Program as below;

int gatevalue1; //Declare all of the variables
int gatevalue2;
int gatevalue3;
int gatevalue4;
int gatevalue;
int inputPin1 = 4;
int inputPin2 = 5;
int inputPin3 = 6;
int inputPin4 = 7;
int Output1Pin = 2;
int Output2Pin = 3;
int ledError = 13;
int ledAND = 12;
int ledOR = 11;
int ledNAND = 10;
int ledNOR = 9;
int ledXOR = 8;
//Begin declaring what pin is what
void setup(){
Serial.begin(9600);
pinMode (Output1Pin, OUTPUT);
pinMode (Output2Pin, OUTPUT);
pinMode (inputPin1, INPUT);
pinMode (inputPin2, INPUT);
pinMode (inputPin3, INPUT);
pinMode (inputPin4, INPUT);
pinMode(ledError, OUTPUT);
pinMode(ledAND, OUTPUT);
pinMode(ledOR, OUTPUT);
pinMode(ledNAND, OUTPUT);
pinMode(ledNOR, OUTPUT);
pinMode(ledXOR, OUTPUT);
gatevalue = 0;
gatevalue1 = 0;
gatevalue2 = 0;
gatevalue3 = 0;
gatevalue4 = 0;
}
void loop(){
gatevalue1 = gatevalue1 + (check_Gate1(false, false)*1); //When an input is HIGH it will add a value to the gatevalue
gatevalue1 = gatevalue1 + (check_Gate1(false, true)*2); //and each gate will have a different gatevalue.
gatevalue1 = gatevalue1 + (check_Gate1(true, false)*4);
gatevalue1 = gatevalue1 + (check_Gate1(true, true)*8);

gatevalue2 = gatevalue2 + (check_Gate2(false, false)*1); //When an input is HIGH it will add a value to the gatevalue
gatevalue2 = gatevalue2 + (check_Gate2(false, true)*2); //and each gate will have a different gatevalue.
gatevalue2 = gatevalue2 + (check_Gate2(true, false)*4);
gatevalue2 = gatevalue2 + (check_Gate2(true, true)*8);

gatevalue3 = gatevalue3 + (check_Gate3(false, false)*1); //When an input is HIGH it will add a value to the gatevalue
gatevalue3 = gatevalue3 + (check_Gate3(false, true)*2); //and each gate will have a different gatevalue.
gatevalue3 = gatevalue3 + (check_Gate3(true, false)*4);
gatevalue3 = gatevalue3 + (check_Gate3(true, true)*8);

gatevalue4 = gatevalue4 + (check_Gate4(false, false)*1); //When an input is HIGH it will add a value to the gatevalue
gatevalue4 = gatevalue4 + (check_Gate4(false, true)*2); //and each gate will have a different gatevalue.
gatevalue4 = gatevalue4 + (check_Gate4(true, false)*4);
gatevalue4 = gatevalue4 + (check_Gate4(true, true)*8);

if(gatevalue4 == gatevalue3 && gatevalue3 == gatevalue2 && gatevalue2 == gatevalue1)
{
gatevalue=gatevalue4;
if(gatevalue==8)
{
Serial.println("The gate is an AND gate."); //When gatevalue is 1 it is an AND gate
digitalWrite(ledError, LOW); //if gate is in, light is off
digitalWrite(ledAND, HIGH);
digitalWrite(ledOR, LOW);
digitalWrite(ledNAND, LOW);
digitalWrite(ledNOR, LOW);
digitalWrite(ledXOR, LOW);
}

else if(gatevalue==7)
Serial.println("The gate is an NAND gate.");
digitalWrite(ledError, LOW); //if gate is in, light is off
digitalWrite(ledAND, LOW);
digitalWrite(ledOR, LOW);
digitalWrite(ledNAND, HIGH);
digitalWrite(ledNOR, LOW);
digitalWrite(ledXOR, LOW);
}
else if(gatevalue==14)
{
Serial.println("The gate is an OR gate.");
digitalWrite(ledError, LOW); //if gate is in, light is off
digitalWrite(ledAND, LOW);
digitalWrite(ledOR, HIGH);
digitalWrite(ledNAND, LOW);
digitalWrite(ledNOR, LOW);
digitalWrite(ledXOR, LOW);

}
else if(gatevalue==6)
{
Serial.println("The gate is an XOR gate.");
digitalWrite(ledError, LOW); //if gate is in, light is off
digitalWrite(ledAND, LOW);
digitalWrite(ledOR, LOW);
digitalWrite(ledNAND, LOW);
digitalWrite(ledNOR, LOW);
digitalWrite(ledXOR, HIGH);
}
else
{
Serial.println("ERROR: Gate Not Present.");
Serial.println(gatevalue);
digitalWrite(ledError, HIGH); //if gate is in, light is off
digitalWrite(ledAND, LOW);
digitalWrite(ledOR, LOW);
digitalWrite(ledNAND, LOW);
digitalWrite(ledNOR, LOW);
digitalWrite(ledXOR, LOW);
}

delay(1000);
}

int check_Gate1(int output1, int output2)
{
int x1;
digitalWrite(Output1Pin, output1);
digitalWrite(Output2Pin, output2);
delay(5); // Make sure the signal has time to propogate through the gate.
x1 = digitalRead(inputPin1);

return x1;
}

int check_Gate2(int output1, int output2)
{
int x2;
digitalWrite(Output1Pin, output1);
digitalWrite(Output2Pin, output2);
delay(5); // Make sure the signal has time to propogate through the gate.
x2 = digitalRead(inputPin2);

return x2;
}
int check_Gate3(int output1, int output2)
{
int x3;
digitalWrite(Output1Pin, output1);
digitalWrite(Output2Pin, output2);
delay(5); // Make sure the signal has time to propogate through the gate.
x3 = digitalRead(inputPin3);

return x3;
}
int check_Gate4(int output1, int output2)
{
int x4;
digitalWrite(Output1Pin, output1);
digitalWrite(Output2Pin, output2);
delay(5); // Make sure the signal has time to propogate through the gate.
x4 = digitalRead(inputPin4);

return x4;
}

Logic_Tester.ino (4.78 KB)

Place some Serial.println(variable) statements at strategic locations to see if variables are what you think they are.

Use CTRL T to format your code.
Attach your sketch between code tags
[code]Paste your sketch here[/code]

Please edit your post
Add
** **[code]** **
before your code
Add
** **[/code]** **
after your code

Easier to read, no smileys and easier to copy.

FYI:
In theory you can not interface 74LSxx logic directly to an 328P (and probably other AVRs). Using 74LS00 datasheet

The minimum garanteed Voh for the 74LS00 is 2.5V. This is below the minimum Vih (3V) that the 328P requires. So you can end up in a situation where the 328P does not know if it's a low or a high.
Similar the maximum Vol of the 328P is 0.9V and the maximum Vil of the 74LS00 is 0.8V. So you can end up in a situation where the 74LS00 does not know if it's a low or a high.

These are worst case scenarios but in both cases you can end in nobody land. Check the datasheets, the loads (Iil, Iih, Iol, Ioh).