This sketch performs as our target. The LEDs respond to changes in light. Taking advantage of bit operations, the sketch sends signals to all the LEDs. The number of LEDs that are lit is proportionate to the intensity of the light hitting the photoresistor.

When this sketch is launched from the Arduino IDE, the Serial Monitor can be used to change input device. You can enter 0 to change to input from the potentiometer. Entering 1 will switch to input from the photoresistor.

In the deployment configuration, the Arduino in not connected to a computer and has its own power supply. It will read from the photoresistor only and our target is reached.