Dividing by 1023 or 1024? The final verdict on analogRead

NB: The result from analogRead() is not a value (as we would like to think of it when measuring something), its an index. Its an index to a bin number in which the measured value fits, and there are 1024 bins (which has to represents the whole range of values you want to measure).

Because the values returned by analogRead() are the indices, we need to calibrate these indices with respect to two known points in order to figure out the exact value of the unknown input voltage of the ADC. What are these two known points:

1. 0V at the input of the ADC ----> ADC produces 00 0000 0000
2. 5V (equal to VREF = Full Scale) at the input of ADC ----> ADC produces 11 1111 1111
3. VDC (unknown voltage) at the input of ADC -----> ADC produces ? (say, ADC)

ADC = ((11 1111 1111)/5)*VDC = (1023/5)*VDC