My previous theory was wrong, so why does this work

arduinophotoresistorresistance

Hi I am new to electronics, and I have made a light tripwire using an Arduino Uno. I made this on the idea that electricity follows the path of least resistance, which I now know to be false (https://physics.stackexchange.com/questions/5670/electricity-takes-the-path-of-least-resistance).
False or not however, my tripwire works exactly as I would expect it to.

I programmed my board to sound an alarm if pin 2 reads low voltage
I thought it worked because if the photoresistor has less resistance than the resistor, then it would read high voltage and vice versa. So can anyone explain what is happening?

schematic

simulate this circuit – Schematic created using CircuitLab

Best Answer

It's called a voltage divider. "The path" does not change. The current changes, because the total resistance LDR1+R1 changes while the voltage applied remains fixed, so the voltage across R1 (which is what you are measuring at U1 pin 2) changes.