So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Seif_1999
#86520 I am trying to create a simple webpage on a web server where I can control an LED using a momentary push button in the web page, where as long as I am pressing the button the LED is on and turn off again when I release the button.
Is this even possible?
I tried a simpler example where I press the button once to turn on and another time to turn off and it worked flawlessly but I have no idea to how to make it work the way described above.
User avatar
By rudy
#86556 Yes it is possible but it is more complex. You need to have some JavaScript code for the button press and release. Then either websockets or AJAX to do the transfer to the ESP8266.

https://www.w3schools.com/jsref/event_onmouseup.asp
https://www.w3schools.com/jsref/tryit.a ... edown_html

I have not looked closely at the following (not enough time right now), but what I have seen of his other posts I think it should explain things better than most I have seen on the topic. You might want to see some of his other ESP8266 code examples as well.
http://www.martyncurrey.com/esp8266-and ... -and-ajax/