Loading simulator…
A digital input needs a defined voltage even when its switch is open. A pull-down resistor holds GPIO_IN near 0 V until SW1 deliberately connects it to VCC = 3.3 V.
SW1 open, no supply current reaches the input. A resistor from GPIO_IN to ground prevents it from floating and gives a reliable LOW.R1 = 10 kΩ between GPIO_IN and GND. The existing SW1 and I_SW connect the node to VCC when closed.I_SW is negligible. Closed, the node rises to 3.3 V and I_SW reads approximately 0.33 mA through the pull-down resistor.Toggle SW1 open and closed in EWsim. Observe approximately 0 V/open and 3.3 V/closed at GPIO_IN; current appears only when the switch closes. Try 1 kΩ for the pull-down and observe the higher closed-state current.