void setup() {
// put your setup code here, to run once:
pinMode(8, OUTPUT);
attachInterrupt(digitalPinToInterrupt(2), apagar, RISING);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(A0) == 1)
{
digitalWrite(8, HIGH);
delay(5000);
}
}
// ISR pin 2
void apagar() {
digitalWrite(8, LOW);
}