Connecting both ends of battery with a resistor is fine?
If you buy a battery it is labeled + or - on each end. The + side [end] is ...

Don't worry about electrons. Current flows from positive to negative when you make a circuit.

Resistors limits the current/amps but keeps the voltage the same. Correct?

Yes, if you don't overload your battery. The battery has some internal resistance and when you connect a load the battery terminal voltage will drop as you have now created a potential divider. More later.

You don't want to connect them together with a wire since there would be too much current flowing through, such that the battery heats up till it explodes or something. So connecting a high ohm resistor between a battery would be fine. Correct?

Yes.

Can someone also explain to me WHY a voltage divider works? All websites just explain the formula and the circuit.




simulate this circuit &ndash; Schematic created using CircuitLab
Figure 1. A voltage divider.
Here we have a 9 V battery and a total load resistance of 9 kΩ. From Ohm's law we can calculate that a current of 1 mA will flow through the circuit. \$ I = \frac V R = \frac 9 {9k} = 1 \,\mathrm {mA} \$.
Again, using Ohm's law we can calculate the voltage across each of the resistors. This will show that there is 7 V across R1 and 2 V across R2. It should be fairly intuitive that the voltage at V2 is 2/9 that of V1. And if you work out how you knew that you'd find that you were thinking along the lines of &quot;what fraction is 2k out of the total?&quot;. The answer, of course, is \$ \frac 2 {2 + 7} = \frac {R_2}{R_1 + R2} \$.

The main reason I asked these questions was since I was learning about Arduino pullup pins. I noticed a voltage divider in the circuit. The digital input pin measures the voltage right? If the voltage is almost 0/ground it returns LOW else HIGH.

Not quite.

Figure 2. Threshold voltages for various logic families. Image source Next.gr.
To guarantee a correct reading of a digital input signal you need to exceed VIH (input high) voltage level for logic '1' and you need to get below VIL (input low) voltage level for logic '0'. See the linked article for more.



simulate this circuit
Figure 3. A microcontroller with a 1 MΩ input impedance and an external 1 MΩ pull-up resistor.
I'll leave this as a mental exercise for you.

The microcontroller's input has a resistance of about 1 MΩ to ground.
The external circuit consists of a GND connected push-button and a 1 MΩ pull-up.
When the SW1 is pressed we get 0 V on the input. Since this is &lt; VIL the chip will read a logic '0'.
Q1: When SW1 is released what is the voltage on the input?
Q2. Is it enough to guarantee it to be read as logic '1'?
Q3. If not, what would you change to make it work reliably?