this is the circuit of pushbutton
1. The following diagram (Fig-1) says that ACTIVE HIGH (AH) for Trigger Level of the interrupting signal is not permissible for Arduino UNO. The available options are: FALLING (Falling Edge, FE), LOW (Active Low), and RISING (Rising Edge, RE).
2. Carry out this tutorial to verify the functioning of the INT1 interrupt and then correct/tune your sketch.
(1) Install the interrupting device K2 at DPin-3 of Arduino as per Fig-2. If you don’t have switch, then use a jumper.
(2) Install R1-LED1 network on the breadboard as per Fig-2.
(3) L is already on the UNO Board.
(4) Create and upload the following sketch. Save the sketch as int1.
volatile bool flag = false;
pinMode(3, INPUT_PULLUP); //internal pull-up resistor is engaged.
attachInterrupt(digitalPinToInterrupt(2), ISRINT0, LOW); //interrupt logic auto enabled; LOW trigger level
if(flag == true) //ISR blinks LED1 for 3 times at 2-sec interval
for(int i = 0; i < 5; i++)
flag = false;
else //MLP continuously blinks L at 1-sec interval
void ISRINT1() //Side job; it blinks LED1 for 5 times at 2-sec interval
//because delay() function does not work in ISR; so, we cannot blink LED1 here;
//blinking must be done in the loop()function based on value of flag.
flag = true;
} //Interrupt structure becomes enabled
(5) Press the RESET button of UNO. Check that L is continuously blinking at 1-sec interval.
(6) Press K2 and hold it. Check that L is not blinking; but, LED1 is continuously blinking at 2-sec interval.
(7) Release K2. Wait for a while and observe that L is blinking again at 1-sec interval.
** **(8)** **
Press K2 and hold just for a while until LED1 just makes a blink and then release K2. Check that LED1 has made 4 more blinks at 2-sec interval. Now, we have 5 blinks including first short one.
(9) Check that L has started blinking at 1-sec interval.
(10) Repeat the process from Step-5.
(11) This is the end of INT1 tutorial.