1
\$\begingroup\$

enter image description here

Hi there,

Im just starting out electrical stuff. And for the life of me I can't figure out why it works this way. So I'm trying to wire two pull-up buttons on an ESP32. I understand why the second figure does not work, i.e. pressing one button triggers both. But why does the first figure work, i.e. pressing one buttons does not trigger the second?

When I press one of the button, shouldnt the entire circuit complete and all the electrons flow to the ground through the one switch that is completed? Thus putting the state of both GPIO pins to low?

\$\endgroup\$
1
  • \$\begingroup\$ The electrons would be flowing to +5 V, not to ground. Electron flow is in the opposite direction of conventional current. \$\endgroup\$
    – Hearth
    May 7, 2021 at 5:04

1 Answer 1

1
\$\begingroup\$

IN the working circuit, you have two independent circuits in paralllel between +5V and Gnd. What you do with one circuit will not affect the other circuit.

You may have heard the expression "Current will follow the path of least resistance". That expression, while true, is incomplete and misleading. Many beginners seem to read it as "current will only follow the path of least resistance", which is definitely wrong.

Current will follow all possible paths, with the current in each path determined by the resistance in that path.

\$\endgroup\$
3
  • \$\begingroup\$ oh i see, but then why does pushing one button affect the other one in the second diagram? since at that point they are already split into two circuits? does the resister do something (whether its before or after the split)? \$\endgroup\$
    – Kerbash
    May 7, 2021 at 4:51
  • \$\begingroup\$ In the second drawing, with only one resistor, the two GPIO pins are connected together, along with the left end of both buttons, so pressing either button will ground both GPIO pins. \$\endgroup\$ May 7, 2021 at 5:01
  • \$\begingroup\$ Oh ok i see thank you so much \$\endgroup\$
    – Kerbash
    May 7, 2021 at 5:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.