Hi,
in this example :
volatile int state = LOW;
void setup() {
pinMode(BOARD_LED_PIN, OUTPUT);
pinMode(20, INPUT);
attachInterrupt(20, blink, CHANGE);
pinMode(21, INPUT);
attachInterrupt(21, blink, CHANGE);
}
void loop() {
digitalWrite(BOARD_LED_PIN, state);
}
void blink() {
// test pin has an interrupt
// ?????
if (state == HIGH) {
state = LOW;
} else { // state must be LOW
state = HIGH;
}
}
Blink function is attached to two interruptions for pins 20 and 21 :
attachInterrupt(20, blink, CHANGE);
attachInterrupt(21, blink, CHANGE);
In the blink function, is it possible to know what has triggered the interrupt pin?
Thank you for your answers