Code:
#define Input_Status 21
bool Input_Start = false;
void setup()
{
// put your setup code here, to run once:
Serial.begin(19200);
pinMode(Input_Status, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(Input_Status), CheckInputIntHandler, FALLING);
}
void loop()
{
// put your main code here, to run repeatedly:
if(Input_Start)
{
Input_Start = false;
Serial.println("Yes External Interuupt Occured!!");
}
delay(5);
}
void CheckInputIntHandler()
{
NVIC_DISABLE_IRQ(Input_Status);
Input_Start = true;
NVIC_ENABLE_IRQ(Input_Status);
}
Please anybody clear me is that correct way to declare external interrupt?
can i disable and enable interrupt in interrupt handler?
yes is compile and running. is that ok?