This
if (digitalRead(7)==HIGH) {pin7=1;} else {pin7=0;};
is a heap of obfuscation that could be
pin7 = digitalRead(7);
This
if (digitalRead(7)==HIGH) {pin7=1;} else {pin7=0;};
is a heap of obfuscation that could be
pin7 = digitalRead(7);