# Pin Change interrupt - Finding various variable names

**URL:** <https://forum.arduino.cc/t/pin-change-interrupt-finding-various-variable-names/1175669>\
**Category:** UNO R4 Minima\
**Created:** [October 6, 2023, 12:30pm UTC](https://forum.arduino.cc/t/pin-change-interrupt-finding-various-variable-names/1175669 "2023-10-06T12:30:16Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![jorgetrujilloroman](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jorgetrujilloroman/32/1007828_2.png) [@jorgetrujilloroman](https://forum.arduino.cc/u/jorgetrujilloroman)\
**Post date:** [October 9, 2023, 12:47pm UTC](https://forum.arduino.cc/t/pin-change-interrupt-finding-various-variable-names/1175669/7 "2023-10-09T12:47:27Z")

</div>

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:

```arduino
// 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:

 ![interruptions](https://europe1.discourse-cdn.com/arduino/original/4X/7/5/4/75416e85b5a551178863b276b007a1364aa6dd92.jpeg)

To know the available pins for interruptions I used the [Full Pinout document](https://docs.arduino.cc/resources/pinouts/ABX00080-full-pinout.pdf?_gl=1*th7e2c*_ga*NDQ1ODYxOTcwLjE2OTU3MzYzNjA.*_ga_NEXN8H46L5*MTY5Njg1NTA5OC4zNy4xLjE2OTY4NTU1ODkuMC4wLjA.)

And the excel image that @KurtE attached.

I hope it helps you 🙂

---

_[View the full topic](https://forum.arduino.cc/t/pin-change-interrupt-finding-various-variable-names/1175669)._
