void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Led acionado por Botão, ESP32!");
pinMode(4, INPUT_PULLUP);
pinMode(2, OUTPUT);
}
void loop() {
int x = digitalRead(4);
Serial.println(x);
if (x == 0){
digitalWrite(2, HIGH);
}
else (digitalWrite(2, LOW));
// put your main code here, to run repeatedly:
delay(100); // this speeds up the simulation
}