I’m currently doing the Arduino class on Instructables (it’s free, you should check it out), but I’ve gotten to a part which isn’t really making any sense to me.
With the button unpressed, pin 2 gets a HIGH signal, which in turn tells the Arduino to send a HIGH signal to the LED, turning it on.
Pressing the button, however, sets a LOW signal to pin 2, which in turn sends a LOW signal to the LED, turning it off.
OK, so this much I can understand from an abstracted point of view, but I was to try understanding why this is the case, and I’m just getting confused. Here’s what the lesson says:
At rest, the switch leads are not connected to one another. Pin 2 is connected through a beefy 10K resistor to 5V. When the button is pressed, the switch leads are connected, which allows pin 2 to be connected to ground, with no resistor. Since electricity takes the path of least resistance, the pin will sense the connection to ground strongly, and ignore the weak (10K) connection to 5V.
OK, are you sure? Unless I’m misunderstanding something here, the 10K resistor is involved regardless of the state of the switch? I get that the Arduino itself must be more of a resistor than a direct connection to ground via the switch, but that’s not how it’s worded, which is making me confused.
Am I just being dumb or something?