Skip to main content
Tweeted twitter.com/StackArduino/status/674491621921157120
edited title
Link
chandrayaan1
  • 195
  • 1
  • 4
  • 8

Why LED light delay is 5 second in arduino?

Source Link
chandrayaan1
  • 195
  • 1
  • 4
  • 8

Why light delay is 5 second in arduino?

My code :

int pin = 8;
int pout = 12;
int result=0;
void setup() {
  pinMode(pin, INPUT);
  pinMode(pout, OUTPUT);  
}

void loop() {

  result = digitalRead(pin);

  if(result == 1)
  {
    digitalWrite(pout, HIGH); 
    delay(1000);
  }
  if(result == 0)
  { 
    digitalWrite(pout, LOW); 
  }

}

I have set delay 1 sec but whenever i put high voltage on pin 8 The LED glow for 5 second. why?

How to set delay to none ? means whenever the pin 8 is HIGH the LED will glow else off.