const int ledPin = 13; // Chân LED tích hợp
const int buttonPin = 2; // Chân nút nhấn

volatile bool ledState = LOW;

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT_PULLUP);

  // Gắn ngắt vào nút nhấn, gọi hàm handleButtonPress khi nút nhấn được nhấn
  attachInterrupt(digitalPinToInterrupt(buttonPin), handleButtonPress, FALLING);
}

void loop() {
  // Không làm gì trong vòng lặp chính
}

void handleButtonPress() {
  ledState = !ledState; // Đổi trạng thái LED
  digitalWrite(ledPin, ledState);
}