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.