Arduino measures the voltage on a voltage divider composed of a resistor and an LDR (light dependant resistor).
A bar of LEDs are illuminated corresponding to the measured voltage.
* Learn how to use an LDR
* Learn how to illuminate a bar of LEDs according to a measured voltage
Step 1: What you need
* Arduino UNO
* Some LEDs
* A 560 Ohm resistor for each LED (or a value similar to that)
* A 10k Ohm resistor
* An LDR
* Breadboard for wiring up e.g. (http://www.oomlout.co.uk/prototyping-bundle-for-arduino-ardp-p-186.html)
* Some Wires
Step 3: How to Illuminate the LEDS in a Bar
sensorValue = analogRead(analogInPin); // read the analog in value
ledLevel = map(sensorValue, 0, 700, 0, NbrLEDs); // map to the number of LEDs
The sensorValue range is 0 to 1023 theoretically. Practically it goes between about 0 and 700 for daylight and the chosen component values.
ledLevel will be 0 to 6 for example (if NbrLEDs = 6), over that same input range.
All you have to do then is use a for loop to turn ON the LEDs based on the ledLevel.