#include #include #include #include #include #include #define TIME_SORTIDA 8000 //ms #define TIME_ESPERA 40000 //ms // Set these to your desired credentials. const char *ssid = "Som_pols"; const char *password = "saladrigues"; const char* host = "esp32-webupdate"; WebServer httpServer(80); HTTPUpdateServer httpUpdater; #define R1 13 #define R2 27 #define SENSOR A0 // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. Serial.begin(115200); pinMode(R1, OUTPUT); pinMode(R2, OUTPUT); pinMode(SENSOR, INPUT_PULLUP); digitalWrite(R1, LOW); digitalWrite(R2, LOW); Serial.println("Configuring access point..."); // You can remove the password parameter if you want the AP to be open. WiFi.softAP(ssid, password); IPAddress myIP = WiFi.softAPIP(); Serial.print("AP IP address: "); Serial.println(myIP); httpUpdater.setup(&httpServer); httpServer.begin(); MDNS.addService("http", "tcp", 80); Serial.printf("HTTPUpdateServer ready! Open http://%s.local/update in your browser\n", host); } unsigned long time_stop = millis(); boolean sensor_active = false; void loop() { httpServer.handleClient(); if ((digitalRead(SENSOR))&&(!sensor_active)) { sensor_active = true; Serial.println("Entrada activada"); } else if ((sensor_active)&&((millis()-time_stop)