I used a PIC16F628a to first calibrate to the resistance of the IR Detector then a second program to control the LED array based on the calibration numbers. I could have easily used a photoresitor, but the IR detector diode was all I had. As your hand gets closer the resistance drops and the LED array moves. This could also be accomplished in a dark room with a flash light.
All credit goes to Brad Slattery (00retrobrad00) for his ADC tutorial. I just added a different kind of resistor to get the same effect. The tutorial can be found here: http://www.bradsprojects.com/index.php?option=com_content&task=category&a...
I have an IR LED connected to a pin that has ADC. It takes an analog value and converts it into a digital number (0-255). This number represents the light level and the LEDs are turn on based on how much light the IR LED sees.
Spanky85 1 year ago