All of us know that IR Leds are widely used as sensors in different type of bots. However this project aims at using normal Led’s as sensor. Due to the semiconductor properties of LEDs they are capable of detecting light in the same or close to the wavelength they would normally emit. However the problem is the voltage produced is so less, that accuracy gets compromised. The algorithm is really easy to implement.
According to the algorithm you first make all the analog input as output and pull all the pins to low so all led’s light up. One by one you one pin analog input while making the other sets of led’s glow as a normal gpio pin. After you have read all the input, adjust the PWM of blue led based on the amount of light that was measured and this process continues forever. It’s a must do project if you have started to learn Arduino as it will expose you with the concept of PWM and ADC.