Potentiometers are another type of variable resistor – they are usually attached to a knob and their resistance is set by turning the knob left and right. In this diagram, a trim pot is used to change the voltage feeding in to the photoresistor. This affects its ability to detect light and alters the balance of the potential divider, so that the amount of change registered by the sketch (base – v, in the code above) can be increased or decreased.
For a more digital approach, you can instead wire the pot in the same way as a photoresistor and read it using a second analog input. You can then use that measurement in the sketch to determine a new value for the variable threshold.
Other Applications
The two example circuits here demonstrate the basic steps involved in detecting changes in light levels with a photoresistor and an Arduino. More interesting projects, such as for home automation and alarm systems, can be constructed using additional components like relays, motors, and wireless communication devices.
Learn more about the Arduino and useful components at Udemy.com.