How to remove button debouncing in Interrupt Function (ISR).

Hello..!
I had a attached an interrupt function with press button (digital pin 2).
But problem is that when i Press the button, interrupt function called more than once because of debouncing
Since it is not recommended to use delay() in interrupt function.
so how do i stop debouching..?

void setup()
{
  pinMode(2, INPUT);
  Serial.begin(9600);
  attachInterrupt(0, blink, RISING);

}
void blink()
{
      state = HIGH;
      Serial.println("Interrupt Function.");

}

You can't do serial prints in ISRs.
Debounce switches in your normal code not in interrupt routines.
Use interrupts with fast conditioned signals.

interrupt function called more than once because of debouncing

No, it isn't. The ISR is being called more than once because of bouncing. Debouncing is the art of dealing with that problem.

Pauls!!!
sorry!! for my mistake.

The ISR is being called more than once because of bouncing.

how can i stop calling ISR more than once.

how can i stop calling ISR more than once.

You can't. You can do something when the time between a trigger of the ISR and the previous trigger is greater than some amount. This means, of course that you need to keep track of when the last time the ISR was triggered (as illustrated in the blink without delay example).

Thank You PaulS.
Now, it is working as Expected. :slight_smile: