if(digitalRead(4) == HIGH){
a = 1;
}else if(digitalRead(7) == HIGH){
b = 1;
}
if(digitalRead(4) == LOW && a == 1){
num = num + 1;
ins[num] = 2;
Serial.print(num);
a = 0;
Serial.print(num);
}
if(digitalRead(7) == LOW && b == 1){
num = num + 1;
ins[num] = 1;
Serial.print(ins[num]);
b = 0;
}
if(num == 5){
Serial.println("5le");
s = true;
for(int i = 0; i < 5; i++){
Serial.println(ins[i]);
if(pass[i] == ins[i]){
}else{
s = false;
}
}
num = 0;
}
My system for how to check when a button is pressed is when the pin the button is connected goes HIGH then a is set at 1. then it detects at any time if the button is LOW and a == 1.
but the weird thing is when i press the button 5 times you would expect the Output on the Serial Screen to be "11223344555le" Correct? but Seem to be getting "1122334452" and the procedure on the is that i press the button connected to pin4 5 times.
can someone please tell me what im doing wrong?
My code is written in JAVA format so im not sure if theres something different about the 2 languages that im missing.