I'm completely new to electronics, and have been trying to come up with a way to connect 10 SPDT switches to a single analog pin on my Ardiono Mega 2560 (and off course connected to 5V and Ground). The idea is to enable as many switches on a single pin, to try and free up pins for other uses.
I've put 10 switches in series, with unique resistor values on one pole of each, and in this way, trying to represent the bit values, 1,2,4,8,16,32,64,128,512, which will give me a resolution of 0-1023 integral values, which is the range that I understand the ADC on the Arduino chip supports. The voltage divider works, and gives the correct voltage, but ONLY when a single switch is flipped.
My circuit looks as follows:

Here we can see that the last switch is thrown, and the output voltage is 2.5V, which corresponds to a digital value of 512 as expected. However, when using more than one switch, the voltage drops more, giving me the inverse result of what I'm looking for.
I don't know if what I'm showing here makes sense, but ideally, I want to be able to detect the position of any combination of switches, by converting the voltage to binary and work from there.