Hi. do you have any example like GPIO digital output on Asynchronous web server but with digital input? I tried to do something similar, but i have some trouble to show an circle in web page that changing the colour when the input status change
Hi Luis.
At the moment, we just have web server examples that display sensor readings.
For your particular application, it would be a good idea to use server-sent events. When the input changes, the server (ESP32) sends an event to the client (the browser).
When that happens, use JavaScript to change the color of the circle. Learn more about changing the style of HTML elements using JavaScript: https://www.w3schools.com/js/js_htmldom_css.asp
At the moment, we don’t have any tutorial explaining server-sent events in detail. We have these two tutorials that use server-sent events. You can take a look at them for examples on how to implement them.
https://randomnerdtutorials.com/esp32-esp-now-wi-fi-web-server/
https://randomnerdtutorials.com/esp32-iot-shield-pcb-dashboard/
You can also take a look at the official AsyncWebServer documentation: https://github.com/me-no-dev/ESPAsyncWebServer#async-event-source-plugin
I hope this helps.
Regards,
Sara