Analog to Digital Conversion

In order to detect the state of the lights, ADC was used. ADCON1 was configured so that the 10-bit conversion value was right justified, and so that RA0 was the only analog input port. Also, Vref+ was set to be Vdd and Vref- was set to be Vss. Vdd was 5V, and Vss was ground (0 V) so this was the maximum value of the conversion \[\mathrm{ADC~value} = \frac{\mathrm{incoming~voltage} \times 1024}{5}\]