Comments on: ESP32/ESP8266 Web Server: Control Outputs with Timer https://randomnerdtutorials.com/esp32-esp8266-web-server-timer-pulse/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Fri, 02 Jan 2026 14:09:19 +0000 hourly 1 https://wordpress.org/?v=6.8.5 By: Sara Santos https://randomnerdtutorials.com/esp32-esp8266-web-server-timer-pulse/#comment-1145297 Fri, 02 Jan 2026 14:09:19 +0000 https://randomnerdtutorials.com/?p=96485#comment-1145297 In reply to Moreira.

Hi.
Can you provide more details about your issue?
Regards,
Sara

]]>
By: Moreira https://randomnerdtutorials.com/esp32-esp8266-web-server-timer-pulse/#comment-1144365 Wed, 31 Dec 2025 01:53:38 +0000 https://randomnerdtutorials.com/?p=96485#comment-1144365 how can I solve this problem, when upload. What I need to check ?

]]>
By: GarberPark https://randomnerdtutorials.com/esp32-esp8266-web-server-timer-pulse/#comment-1009599 Thu, 20 Feb 2025 19:39:25 +0000 https://randomnerdtutorials.com/?p=96485#comment-1009599 use:
server.on(“/”, HTTP_GET, [&](AsyncWebServerRequest* request) {
request->send_P(200, “text/html”, index_html, [&](const String& var) -> String {
return processor(var);
});
});
to remove warning about deprecated use of send_P..

]]>
By: Matthew Jones https://randomnerdtutorials.com/esp32-esp8266-web-server-timer-pulse/#comment-1000918 Sat, 18 Jan 2025 17:00:42 +0000 https://randomnerdtutorials.com/?p=96485#comment-1000918 Can anyone post a version of this without the slider? Just a fixed value for the duration, with just the button? I feel like I should be able to do this, but I suppose I don’t understand the code well enough – every time I try I end up leaving in stuff I don’t want, and eliminating stuff that is necessary.

]]>
By: JC Chap https://randomnerdtutorials.com/esp32-esp8266-web-server-timer-pulse/#comment-898564 Fri, 15 Mar 2024 15:12:24 +0000 https://randomnerdtutorials.com/?p=96485#comment-898564 Bonjour
quelle valeurs faut-il modifier pour obtenir un timer en minutes.
merci
Hello,
what values should be modified to obtain a timer in minutes.
THANKS

]]>
By: George https://randomnerdtutorials.com/esp32-esp8266-web-server-timer-pulse/#comment-884730 Thu, 18 Jan 2024 09:02:54 +0000 https://randomnerdtutorials.com/?p=96485#comment-884730 In reply to George.

Hi i found it if the board is esp8266 need to change the const int output = 2; to
const int output = 5; as gpio 5 is d1 for esp8266

]]>
By: George https://randomnerdtutorials.com/esp32-esp8266-web-server-timer-pulse/#comment-884644 Wed, 17 Jan 2024 20:03:31 +0000 https://randomnerdtutorials.com/?p=96485#comment-884644 Hi how do i change the gpio to d1 for example.
(Thank u)

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-esp8266-web-server-timer-pulse/#comment-855061 Tue, 15 Aug 2023 08:19:51 +0000 https://randomnerdtutorials.com/?p=96485#comment-855061 In reply to Alejandro Gidi.

Hi.
In VS Code, all function definitions should show up before the setup() and it matters the order in which they appear (contrary to the arduino IDE).
Move the String outputState(){
if(digitalRead(output)){
return “checked”;
}
else {
return “”;
}
return “”;
}

To a place before the processor() function.
Regards,
Sara

]]>
By: Alejandro Gidi https://randomnerdtutorials.com/esp32-esp8266-web-server-timer-pulse/#comment-855016 Tue, 15 Aug 2023 02:12:36 +0000 https://randomnerdtutorials.com/?p=96485#comment-855016 Hello, hoping you and your love ones are all in good health.
This is my second project using Platformio on VS, i did the blinking led from your tutorial.

Then i went for this one, i copy pasted the raw code and when I try to upload
I get this :
Building in release mode
Compiling .pio/build/esp32dev/src/main.cpp.o
src/main.cpp: In function ‘String processor(const String&)’:
src/main.cpp:90:31: error: ‘outputState’ was not declared in this scope
String outputStateValue = outputState();
^~~~~~~~~~~
src/main.cpp:90:31: note: suggested alternative: ‘outputStateValue’
String outputStateValue = outputState();
^~~~~~~~~~~
outputStateValue
*** [.pio/build/esp32dev/src/main.cpp.o] Error 1
========================================================================================== [FAILED] Took 1.49 seconds

]]>
By: bromptonaut https://randomnerdtutorials.com/esp32-esp8266-web-server-timer-pulse/#comment-853921 Mon, 07 Aug 2023 10:14:36 +0000 https://randomnerdtutorials.com/?p=96485#comment-853921 In reply to Zurab.

function toggleCheckbox(element) {
var sliderValue = document.getElementById(“timerSlider”).value;
var xhr = new XMLHttpRequest();
if(element.checked){ xhr.open(“GET”, “/update?state=1”, true); xhr.send();
var count = sliderValue, timer = setInterval(function() {
count–;
document.getElementById(“timerValue”).innerHTML = count;
// turn off relay if slider is set back to “off”
if(!element.checked){count = 0;
xhr.open(“GET”, “/update?state=0”, true);
xhr.send();
//
}
if(count == 0){ clearInterval(timer); document.getElementById(“timerValue”).innerHTML = document.getElementById(“timerSlider”).value; }
}, 1000);
sliderValue = sliderValue*1000;
setTimeout(function(){ xhr.open(“GET”, “/update?state=0”, true);
document.getElementById(element.id).checked = false; xhr.send(); }, sliderValue);
}
}

]]>