Pin Change interrupt - Finding various variable names

Hi @pf_bsf,

I made a test using 4 buttons on pins 1, 2, 3 & 4 and it is working fine for me, I made a function that changes the status of the built-in LED using any of these four buttons.

This is my sketch:

// LED and switch
const byte buttonPin1 = 0;
const byte buttonPin2 = 1;
const byte buttonPin3 = 2;
const byte buttonPin4 = 3;
bool status = 1;

void setup() {

  // Set LED as output
  pinMode(LED_BUILTIN, OUTPUT);

  // Set switch as input with pullup
  Serial.begin(9600);
  pinMode(buttonPin1, INPUT_PULLDOWN);
  pinMode(buttonPin2, INPUT_PULLDOWN);
  pinMode(buttonPin3, INPUT_PULLDOWN);
  pinMode(buttonPin4, INPUT_PULLDOWN);
  attachInterrupt(digitalPinToInterrupt(buttonPin1), &my_isr, HIGH);
  attachInterrupt(digitalPinToInterrupt(buttonPin2), &my_isr, HIGH);
  attachInterrupt(digitalPinToInterrupt(buttonPin3), &my_isr, HIGH);
  attachInterrupt(digitalPinToInterrupt(buttonPin4), &my_isr, HIGH);
}

void loop() {
  digitalWrite(LED_BUILTIN, status);

  Serial.print("Button 1: ");
  Serial.println(digitalRead(buttonPin1));

  Serial.print("Button 2: ");
  Serial.println(digitalRead(buttonPin2));

  Serial.print("Button 3: ");
  Serial.println(digitalRead(buttonPin3));

  Serial.print("Button 4: ");
  Serial.println(digitalRead(buttonPin4));

  Serial.print("Status: ");
  Serial.println(status);
  delay(300);
}
void my_isr() {
  status = !status;
}

In my code, all the buttons "activate" the same interruption functions when the state is HIGH and it works properly for me.

This is my setup:

To know the available pins for interruptions I used the Full Pinout document

And the excel image that @KurtE attached.

I hope it helps you :slight_smile: