const byte interruptPin = 14;
volatile byte state = 0;
void setup() {
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), INTR, FALLING);
pinMode(2, OUTPUT);
pinMode(4, OUTPUT);
}
void loop() {
digitalWrite(4, !state);
digitalWrite(2, state);
}
void INTR() {
state = !state;
}