Using non-default pins as external interrupt

Hello,

I have a MKR NB 1500 and I’d like to attach an interrupt on D13 (PB23). This pin is not a part of the default pins that are predefined as interrupt pins (0, 1, 4, 5, 6, 7, 8, 16 / A1, 17 / A2).

I’ve tried changing the code below from this:

{ PORTA, 13, PIO_SERCOM_ALT, (PIN_ATTR_NONE), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }

To this:

{ PORTA, 13, PIO_SERCOM_ALT, (PIN_ATTR_NONE), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }

The code I’m running:

#include <ArduinoLowPower.h>
#define OffButton 13
bool state = HIGH;  

void setup() {
  pinMode(OffButton, INPUT);
  pinMode(LED_BUILTIN, OUTPUT);
  LowPower.attachInterruptWakeup(OffButton, wokenUp, CHANGE);

  delay(1000);

}

void loop() {
  LowPower.deepSleep(10000);
  digitalWrite(LED_BUILTIN, state);  
}

void wokenUp()
{
  state = !state;
}

I don’t get this to work. Neither when trying with the LowPower library. Any ideas to what I am missing on this matter? :slight_smile: