#define LED 12
#define BOTON 4
boolean ledState = LOW;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(LED, OUTPUT);
pinMode(BOTON, INPUT);
}
void loop() {
// Definimos las varibles
int botonState = digitalRead(BOTON);
// Desarrollamos el código
if (botonState == 0){
ledState = !ledState;
digitalWrite(LED, ledState);
delay(200);
}
}
/*
Pines importantes:
35 34 39 36 => Pines solo entradas
Usaremos
Serial.available()
Serial.parseInt()
*/