I apologize if this has been asked and answered before, i found something about it on this forum but it didnt include any details, and my search phrases gave too many results...
Anyhow, im trying to get some leds to work as light sensors, or rather - to use them as touch-switches. Im getting fair adc inputs with some of my "wide angle" LED's but the stronger and thus narrower ones dont seem to be adequate.
Currently im using a 10K resistor and im getting ADC values that are over 200 unless i use a flashlight, and the reverted digital input is always 0.
I'm including my source code in case my pauses are incorrect:
high 1
low 2
high 4
pause 2000
pins=0
start:
dirs=%000001110 '1,2=output
high 1 'source
low 2 'sink
pause 10 'wait 10ms
'reverse bias it
low 1
high 2
pause 10
dirs=%000001010 '1=out 2=in
pause 1
b0=pin2 'read state
b0=b0^1 'invert the result
readadc 2,w1
debug
if b0 = 1 then LEDON
goto start
LEDON:
high 4
goto start
Anyhow, im trying to get some leds to work as light sensors, or rather - to use them as touch-switches. Im getting fair adc inputs with some of my "wide angle" LED's but the stronger and thus narrower ones dont seem to be adequate.
Currently im using a 10K resistor and im getting ADC values that are over 200 unless i use a flashlight, and the reverted digital input is always 0.
I'm including my source code in case my pauses are incorrect:
high 1
low 2
high 4
pause 2000
pins=0
start:
dirs=%000001110 '1,2=output
high 1 'source
low 2 'sink
pause 10 'wait 10ms
'reverse bias it
low 1
high 2
pause 10
dirs=%000001010 '1=out 2=in
pause 1
b0=pin2 'read state
b0=b0^1 'invert the result
readadc 2,w1
debug
if b0 = 1 then LEDON
goto start
LEDON:
high 4
goto start