const byte pin_LED=13;
const byte pin_Btn=3;
const int interval =3000;
void ISRbtn2();
volatile unsigned long previousMillis = 0; // will store last time LED was updated
volatile byte ledstate=LOW;
void setup() {
// put your setup code here, to run once:
pinMode(pin_Btn, INPUT_PULLUP);
pinMode(pin_LED, OUTPUT);
attachInterrupt(digitalPinToInterrupt(pin_Btn), ISRbtn2, RISING);
}
void loop() {
digitalWrite(pin_LED, ledstate);
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
ledstate = LOW;
}
}
void ISRbtn2() {
previousMillis=millis();
ledstate=HIGH;
}