Question.2
For the following setup and code, what will be printed on the serial monitor when the button is pressed and released after 50 ms?
Note: Consider no noise is created from button press.
Code
void ISR_INT0() {
Serial.println("INT0 Triggered");
}
void ISR_INT1() {
Serial.println("INT1 Triggered");
}
void setup() {
Serial.begin(115200);
pinMode(2, INPUT_PULLUP); // Button connected to pin 2
pinMode(3, INPUT_PULLUP); // Button connected to pin 3
attachInterrupt(digitalPinToInterrupt(2), ISR_INT0, FALLING);
attachInterrupt(digitalPinToInterrupt(3), ISR_INT1, FALLING);
}
void loop() {
// Main code does nothing, only waiting for interrupts
}