// int f1=0;
// int f2=0;
// int count=0;
// void setup() {
// pinMode(26, INPUT);
// pinMode(25, INPUT);
// Serial.begin(9600);
// f1 = 0;
// f2 = 0;
// count = 0;
// Serial.println(count);
// }
// void loop() {
// int x = digitalRead(26);
// int y = digitalRead(25);
// if (x == HIGH && f1 == 0) {
// count = count + 1;
// Serial.println("Student present: ");
// Serial.println(count);
// f1 = 1;
// } else if (x == LOW) {
// f1 = 0;
// }
// if (y == HIGH && f2 == 0) {
// count = count - 1;
// Serial.println("Student present: ");
// Serial.println(count);
// f2 = 1;
// } else if (y == LOW) {
// f2 = 0;
// }
// }
int f1 = 0;
int f2 = 0;
int count = 0;
void setup() {
pinMode(26, INPUT);
pinMode(25, INPUT);
Serial.begin(9600);
Serial.println(count);
}
void loop() {
int x = digitalRead(26);
if (x == HIGH && f1 == 0) {
count = count + 1;
Serial.print("Student present: ");
Serial.println(count);
f1 = 1;
} else if (x == LOW) {
f1 = 0;
}
int y = digitalRead(25);
if (y == HIGH && f2 == 0) {
count = count - 1;
Serial.print("Student present: ");
Serial.println(count);
f2 = 1;
} else if (y == LOW) {
f2 = 0;
}
}