#include <stdio.h>
#include "driver/gpio.h"
// #include "freertos/FreeRTOS.h"
// #include "freertos/task.h"

#define CONFIG_LED_PIN GPIO_NUM_2
#define CONFIG_BUTTON_PIN GPIO_NUM_15

volatile bool buttonPressed = false;

void IRAM_ATTR button_isr_handler(void* arg) {
    buttonPressed = true;
}

void setup() {
    gpio_pad_select_gpio(CONFIG_BUTTON_PIN);
    gpio_pad_select_gpio(CONFIG_LED_PIN);
    gpio_set_direction(CONFIG_BUTTON_PIN, GPIO_MODE_INPUT);
    gpio_set_direction(CONFIG_LED_PIN, GPIO_MODE_OUTPUT);
    gpio_set_intr_type(CONFIG_BUTTON_PIN, GPIO_INTR_NEGEDGE);
    gpio_install_isr_service(ESP_INTR_FLAG_EDGE);
    gpio_isr_handler_add(CONFIG_BUTTON_PIN, button_isr_handler, NULL);

    while (true) {
        if (buttonPressed) {
            gpio_set_level(CONFIG_LED_PIN, !gpio_get_level(CONFIG_LED_PIN));
            printf("Button pressed!!!\n");
            delay(1000); // Delay for debouncing
            buttonPressed = false;
        }
    }
}

void loop ()
{

}
$abcdeabcde151015202530354045505560fghijfghij