Hi Tech. I've used the LDR's in the past but read them with the ADCIN command. I've found ADCIN is easier & more accurate to work with. Also, your "if V1" statements have a slight glitch. If the value is exactly 100, the PIC will do nothing.
v1 var byte
portb = 0 'all off
main:
adcin 0,v1
if v1 < 100 then lmp1
if v1 >= 100 then lmp2 'added if equal to
goto main
lmp1:
high portb.6
pause 500
low portb.6
pause 500
goto main 'return is for GOSUB's
lmp2:
high portb.7
pause 500
low portb.7
pause 500
goto main
Bookmarks