Author Topic: External Interrupt pin remains high  (Read 1605 times)

andymcl

  • NewMember
  • *
  • Posts: 7
  • Country: au
External Interrupt pin remains high
« on: October 23, 2019, 01:21:23 AM »
I'm a total novice with interrupts so I would value some assistance.
If create an ISR as per below
attachInterrupt(digitalPinToInterrupt(5), EXT_int1, HIGH)
and the pin remains high for an extended period (mins/hours/days) does the ISR execute repeatedly?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: External Interrupt pin remains high
« Reply #1 on: October 23, 2019, 08:48:16 AM »
Use it like this, example for D0:

Code: [Select]
#define INTERRUPT_PIN 0 /*D0*/

void setup() {
  pinMode(INTERRUPT_PIN, INPUT); /*pin 0 active high*/
/*or:   pinMode(INTERRUPT_PIN, INPUT_PULLUP); using internal pullup, makes pin 0 active low*/
}

attachInterrupt(ACTUAL_DIGITAL_PIN_NUMBER, wakeupISR, HIGH);
/*or attachInterrupt(ACTUAL_DIGITAL_PIN_NUMBER, wakeupISR, LOW); //for active low (pin declared INPUT_PULLUP or pulled up high via resistor) */

void wakeupISR(void) { /*ISR code, if any*/ }