So I have a rather large program that I noticed would react to an input becoming true pretty fast, although there is a very noticeable (2~3 sec.) delay for the input to report back low? so I thought it must be my terrible code skills, so I wrote this test code
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(31, INPUT);
pinMode(13, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(31) == true){
digitalWrite(13, HIGH);
}
else{
digitalWrite(13, LOW);
}
}
I get the same delay when I remove the 5v from input 31? Can anyone explain this and how I can make it faster?