Project 07 How to calculate analog read range along with resistance


when I have started the project 07 I am curious that is there a way to calculate analog read (0-1023) and resistor. For example, in this project shows that without resistor the analog read as 1023.However, if there is a resistor with 220 ohms the analog read as 1001-1002.

Is anyone know that if I want specficc analog read number how much resistance do I need. Is there a formula to calculate these values.

Many Thank,


Voltage will be 5V * 10000 / (220 + 10000) = 4.89 V
analogRead of 4.89V will return 4.89/5 * 1023 = 1000, maybe 1001

You can do the math for the 10,000 and the 1,000,000 top resistors.