In my project I need to use this funcion.
In this video we see a debounce code to resolve the problem… in my case I want to make more inputs and more reads (3 leds for exemple )…
It´s a bad solution to set memory every time that I set the OUTPUT to HIGH or LOW , or no ?
The Debounce was used simple to show a debonce code or there´s other reason?
What do you think ?
We use a debounce code for testing purposes and because we’re using a pushbutton. In final projects, I think it is always better to use a debounce code because it prevents false pushbutton presses or multiples “false” presses in a row.
To save the state of several GPIOs, it is better to use an array, and save that array in the flash memory, or use a different memory position for each GPIO state (which is easier to implement).
Saving the GPIO state in the flash memory and checking the GPIO state in the setup() assures that your GPIOs will return to its current state even when power is removed or when the ESP32 resets.
I hope this is clear.
Let me know if you need further help.