Use the Starter Shield from fireflyelectronix.com the Arduino Uno and Processing to create a Computer Screen Night Light!
Step 1: Program the Arduino
In this example, I am using the Starter Shield from fireflyelectronix.com
The Starter Shield has a photo resistor on analog pin 2.
You can change the code on the first line to match whatever analog pin you are using.
We are converting the 8-bit analog read into 6-bit and then sending it over the serial port (USB)
Step 2: Write a Program in Processing to Read the Serial Data
If you have never used the processing language before, check it out at processing.org
It's a perfect companion to the Arduino, if you want to write computer programs for it.
In the code you may need to modify the line that says "COM4" to match the com port that your Arduino is on. You can look at the Arduino compiler on the lower right corner and it should say what port your Arduino is on.
This code is taking the 6-bit value from the serial port and using it as the RGB value for the background color of our program. Since all three RGB values are equal, you will see it fade from Black to Gray to White.
Try placing a static value anywhere from 0 to 255 in place of the brightnesss value and see what happens.
Step 3: Run the Processing Program
Press the run button on the Processing compiler and you will get a screen that pops up.
Place your hand over the photo resistor and watch the background get lighter.
If you want to make this box larger, go back to the processing code and change the line that says size(500,500) and change it to the same size as your monitor's resolution.