// Define pin numbers
const int buttonPin = 2;
const int ledPin = 13;
volatile bool ledState = false;
void toggleLED() {
ledState = !ledState;
}
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(buttonPin),toggleLED, FALLING);
}
void loop() {
digitalWrite(ledPin, ledState ? HIGH : LOW);
}