int buttonPin = 27;
int ledPin = 2; 
bool currentStateButton;
bool lastStateButton;
bool ledState;

void setup() {
  Serial.begin(115200);
  Serial.println("Hello, ESP32!");
  pinMode(buttonPin, INPUT);
  pinMode(ledPin, OUTPUT); 
}

void loop() {
  lastStateButton = currentStateButton;
  currentStateButton = digitalRead(buttonPin);
  Serial.println(currentStateButton);
  
  if(lastStateButton == LOW && currentStateButton == HIGH){
    Serial.println("Button is pressed");
    ledState = !ledState;
    digitalWrite(ledPin, ledState);
  }

  delay(10); 
}