I've been reading other posts - so I tried this to see if light would turn green - fail


DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50

ADCON1=%10000010

OUTPUT PORTA.1 ' FAULT LED
OUTPUT PORTA.0 ' TIMING LED

ANSEL = PORTA.2 ' Analog in setup for AN2, pin 11

adval var word ' holds analog value
GREEN VAR PORTA.0 ' TIMING LED
RED VAR PORTA.1 ' FAULT LED

low green
low red

main:

ADCIN 2, ADVAL ' read analog coming into pin 11 and store variable in adval
if adval < 500 then
high green
endif

goto main