int reed[26];
int correct[26];
int i = 0;
int Sum = 0;
int Add = 0;
void setup() {
Serial.begin(9600);
pinMode(30, OUTPUT);
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
pinMode(9, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(11, INPUT_PULLUP);
pinMode(12, INPUT_PULLUP);
pinMode(13, INPUT_PULLUP);
pinMode(14, INPUT_PULLUP);
pinMode(15, INPUT_PULLUP);
pinMode(16, INPUT_PULLUP);
pinMode(17, INPUT_PULLUP);
pinMode(18, INPUT_PULLUP);
pinMode(19, INPUT_PULLUP);
pinMode(20, INPUT_PULLUP);
pinMode(21, INPUT_PULLUP);
pinMode(22, INPUT_PULLUP);
pinMode(23, INPUT_PULLUP);
pinMode(24, INPUT_PULLUP);
}
void loop() {
reed[0] = digitalRead(0);
reed[1] = digitalRead(1);
reed[2] = digitalRead(2);
reed[3] = digitalRead(3);
reed[4] = digitalRead(4);
reed[5] = digitalRead(5);
reed[6] = digitalRead(6);
reed[7] = digitalRead(7);
reed[8] = digitalRead(8);
reed[9] = digitalRead(9);
reed[10] = digitalRead(10);
reed[11] = digitalRead(11);
reed[12] = digitalRead(12);
reed[13] = digitalRead(13);
reed[14] = digitalRead(14);
reed[15] = digitalRead(15);
reed[16] = digitalRead(16);
reed[17] = digitalRead(17);
reed[18] = digitalRead(18);
reed[19] = digitalRead(19);
reed[20] = digitalRead(20);
reed[21] = digitalRead(21);
reed[22] = digitalRead(22);
reed[23] = digitalRead(23);
reed[24] = digitalRead(24);
for (i = 0; i < 25; i++) {
Serial.print(i); Serial.print(" ");
Serial.print(reed[i] ); Serial.print(" ");
if (reed[i] == 0) {
correct[i] = 1;
}
else {
correct[i] = 0;
}
Add = correct[i];
Sum = Sum + Add;
Serial.println(correct[i]);
delay(100);
if (i == 24) {
Serial.println();
Serial.println(Sum);
Serial.println();
if (Sum == 25) {
digitalWrite(30, HIGH);
Sum = 0;
}
else {
digitalWrite(30, LOW);
Sum = 0;
}
}
}
}