#include <mechButton.h>

#define LED_PIN 22
#define BTN_PIN 27

mechButton  greenBtn(BTN_PIN);

void setup() {
  
  Serial.begin(115200);
  Serial.println("Hello, ESP32!");
  pinMode(LED_PIN, OUTPUT);
  greenBtn.setCallback(btnClk);
}

void btnClk(void) {

  if (!greenBtn.getState()) {
    digitalWrite(LED_PIN,HIGH);
  } else {
    digitalWrite(LED_PIN,LOW);
  }
}


void loop() {

  idle();
  //delay(1); // this speeds up the simulation
}
Loading
esp32-devkit-c-v4