Here, I have used the D1 (GPIO-5) as OUTPUT, if you use another GPIO pin then replace it with that.
For the INPUT add
Some GPIOs have limitations, if you make them HIGH or LOW during the booting process, the BOOT will fail.
You can refer to the following picture for that.
You can also refer to the following article
https://easyelectronicsproject.com/esp3 ... fi-manual/