I am trying to use a button with a built in LED in my doorbell project. I can get the button to work using the NO ON pins connected to Pin2 and GND, however I want to use the LED function which lights up when the button is pressed. The instructions from the manufacturer below.
I've tried using 5V on the NO pin and joining + with ON and 10K resistor going to Pin 2 on ESP32. Since this is a PullUp configuration, I changed the code to pinMode(BUTTON_PIN, INPUT). No luck
If you have another pin available and need a different behaviour, you could just use the LED/resistor part as an LED on an output pin, and read the switch on an input pin either with a pullup resistor or using INPUT_PULLUP mode.
Usually I would prefer to run the LED separately to retain flexibility and put the process in the loop so the LED is not just telling you about the button but can mean there is some "thought" behind it.