Loading simulator…
The starter circuit connects GPIO_IN to 3.3 V when SW1 is closed, but leaves it undriven when open. A floating input can respond unpredictably to leakage and noise. Add a pull-down resistor without changing the original switch action.
VCC to GPIO_IN only in the closed position. With the contact open, nothing forces the input LOW.R1 = 10 kΩ from GPIO_IN to GND while retaining the existing connection from SW1 to VCC.Toggle SW1: expect 0 V when open and 3.3 V when closed. Disconnect R1 temporarily and notice the node is no longer guaranteed to have a defined voltage in the open state.