ESP32 WROOM and button

I built the WLED on an ESP8266, everything works well and I use the button to control it. Now I want to try to build on ESP32 and nowhere I can find to which pins to connect the button on the ESP32.
I ask for help in this matter, I was looking for a similar question on this forum, but did not find an answer. There is only information on connecting a button to ES8266.

Any pin you want.

Hi, thanks for the reply. But can you be more specific? On nodemcu (8266), the button needs to be connected to GPI0 and GND. I know a specific pin - GPIO, but on ESP32WROOM which pin?

Sounds like you mean a standard build of 0.11 or lower. The button was always 0, but you could make it whatever with a code change.

In 0.12, you can change pins via UI.

May I ask how you connected the button? Is it like a wall switch or a like a small NO / NC button?

I’ve tried to wire a wall switch (NO) like it’s shown on the WLED site. But I can’t get it to work.

I think the default button is a momentary button. I say that because the default button recognition seems to be “short press” or “long press”, which to me means it goes on for some period of time, then goes off, and WLED determines whether that time of being pressed was short or long, and then takes appropriate preconfigured action depending on the detected press.

I think for a standard toggle wall-switch, you need a custom WLED build that disables the short/long press detection.

Does that help?

I actually just fiddled some with the board, read some articles and tried. Now it works!
I use a standard wall switch with the addition of a spring. That makes it like a momentary switch (making sure it’s NormallyOpen).

I connected one wire from the switch to the ground on the board. The other wire from the switch to GPIO0 on the board.

In WLED I set ‘Button pin’ to 0 and deactivated ‘Active high’.
Works like a charm!

You do realize what happens at power up of the board when GPIO 0 is connected to ground, right? It goes into bootloader mode, ready to have firmware loaded.

Did not know that… Thanks!
It’s not connected at power up though, but just in case: What pin do you suggest?

ESP32 Pinout Reference: Which GPIO pins should you use? | Random Nerd Tutorials shows the available GPIO pins in detail. Pick one that is not modified at boot or reset, or connected as an output at boot, or … you get the idea. Pick one that is not related to booting / reset, not already used, can be a digital input, and will not prevent you from doing something because you used a pin that works with other device types, like I2C.

Thanks!
Will try GPIO22 :+1: