Love-o-meter ADC conversion

Hello, i have a quick question. In the third project of the starter kit we convert the ADC reading to voltage. The adc is 10 bit so the values are 0-1023 and the voltage range is 0-5V. So shouldn't the conversion be:

sensorVal = analogRead(A0); voltage = sensorVal/1023.0 * 5.0

In the tutorial book it's: voltage = sensorVal/1024.0 * 5.0 and i am a bit confused as to why it is divided by 1024 and not 1023. Thanks in advance!

analogRead() can give you one of 1024 possible values. If you want to know which one it is, divide by 1024.