To investigate the idea that the program and circuit above is testing the voltage of a decaying R/C discharge waveform, I did the readadc 4 times, with naps between each read. Values of the nap parameter up to the full range (~2 seconds) made no difference in the reading, which continued to run the full range from 0 to 255 depending on whether the LED was completely shadowed, exposed to ambient interior lighting, or to a flashlight at distances from 12 to 2 inches (maximum 255 reading).
Interestingly, the reading with the flashlight was very sensitive to its placement—at right angles, it produced little difference from the ambient lighting reading, and the difference increased as the flashlight moved to directly over the led. That means that the LED is directional in itself without the need for side shielding.
I then commented out the first two lines in the “main” routine, “high cathode” and “low anode”. This greatly reduced the range of the ADC reading, from 0 when occluded to 38 in ambient lighting to 80 when the flashlight (an LED type) was directly above and about a quarter inch away.
I then removed the 330 ohm resister. This made no significant difference in the reading. I then stripped down the original code so there is no “reverse biasing” of the led. There was no great change in the responsiveness of the LED. Moving the circuit so that it was more and less directly pointing at a 60 watt bulb increased and decreased the ADC reading in an expected manner.
So it appears that the reverse biasing increases the range of response but is not crucial for the effect. It appears that an 08M with a single yellow LED could track the sun or other moving light source. Please note that my electronics knowledge is very limited, so any of this is subject to correction and especially, more precise explanation.
<code><pre><font size=2 face='Courier'>
' TEST06D led as light detector (yellow led)--08M
' LED
' pin1- ------|<--.
' |
' pin2- ----------'
symbol cathode=1
symbol anode=2
high anode ' flash test led
low cathode
pause 100
low anode
input anode ' tristate anode (isolate anode pin)
main:
readadc anode, b0 ' get the voltage
gosub printReading ' b0 contains ADC value to be displayed
sleep 3 ' sleep 3 sec
goto main
printReading:
b4 = b0
b5 = 0
w2 = w2 * 45 / 255 ' x = 4.5V * adcVal /255
b6 = w2 / 10 ' whole volts
b7 = w2 % 10 ' tenths of a volt
sertxd ("ADCval=", #b0, "; LED voltage*10=", #w2, "; ", #b6, ".", #b7, "volts",13,10)
return
</font></pre></code>