Question.1
What will happen to the LED when Mark presses the button? (After executing the following code on Arduino)?
Note: Consider that no noise is created from button press.
Code:
#define BUTTON_PIN 2
#define LED_PIN 10
void toggleLED() {
digitalWrite(LED_PIN, !digitalRead(LED_PIN));
}
void setup() {
pinMode(BUTTON_PIN, INPUT_PULLUP);
pinMode(LED_PIN, OUTPUT);
attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), toggleLED, FALLING);
}
void loop() { }