Let us start with some theory. The Raspberry Pi only has digital pins. This results in being unable to read analog values. But with some devices, we are able to read analog values, or rather, create an RC Circuit to cheat a little bit. An RC circuit is a circuitry setup where we place a resistor and a capacitor in series with each other. When a voltage is applied on the circuit, the voltage across the capacitor will rise. The higher the resistor value is, the longer it will take for the voltage to rise across the capacitor.
With a fixed resistor, the time to equalize the voltage before and after the resistor around the capacitor will be the same. When we introduce an LDR, where the resistor value depends on the light intensity, the more light that hits the sensor, the lower the resistance is. With this in mind, we take a look at a feature on the digital pins on...