int rele=22;
int boton=12;
int botonstate=HIGH;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(rele, OUTPUT);
pinMode(boton, INPUT_PULLUP);
digitalWrite(rele, LOW);
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
botonstate= digitalRead(boton);
Serial.print(botonstate);
delay(200);
if (botonstate==LOW)
{
digitalWrite(rele, HIGH);
}
else
{
digitalWrite(rele, LOW);
}
}