I have written a very simple code to test the interrupt functionality of my Arduino Uno expansion board:
const byte buttonPin3 = 3;
void setup() {
pinMode(buttonPin3, INPUT);
attachInterrupt(digitalPinToInterrupt(buttonPin3), trigger, CHANGE);
Serial.begin(9600);
}
void loop() {
}
void trigger(){
Serial.println("trigger");
}
However, the Serial.println("trigger"); is activated as soon as I insert a jumper wire into pins 2 or 3. It seems like I have broken the microcontroller. I would appreciate if you could help me know if there is something wrong with my code or I need to change the microcontroller? if I have to replace the MCU can I just use any identical AVR and just place it on the DIP IC socket adaptor?
P.S. Filip Franik asked me to draw the schematics:

simulate this circuit – Schematic created using CircuitLab
P.S. I used the official Button's tutorial and now everything works just fine. I can't reproduce the issue anymore for no obvious reason!.
