#define button_pin 33
#define led_pin 32
int i=0;
void IRAM_ATTR toggleLED() {
//write here code to change LOW->HIGH and HIGH->LOW
digitalWrite(led_pin,!digitalRead(led_pin));
i++;
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
//Serial.println("Hello, ESP32!");
pinMode(led_pin, OUTPUT);
pinMode(button_pin, INPUT);
attachInterrupt(button_pin, toggleLED, FALLING);
}
void loop() {
// put your main code here, to run repeatedly:
delay(1000); // this speeds up the simulation
Serial.println(i);
}