# StevenS10

• StevenS10 commented on onajad's instructable 100+ Switches in a Single Pin of Arduino6 months ago

This is a great idea, and it probably works well for up to say 10 switches, which is pretty darn good.But take a closer look at the math. It looks like the values you got: 1023, 509, 338, 253, and 202are very close to: 1024, 512, 341, 256, and 205These are of course: 1024 x 1 , 1024 x (1/2), 1024 x (1/3), 1024 x(1/4), and 1024 x (1/5)The difference between consecutive values is getting smaller and smaller. IE, 1023 - 509 is about 500, but 509-338 is 171, and for your last pair, 253-202 = 52.When you extend to say 20 switches, the last two numbers will be approximately 1024 x (1/19) and 1024 x (1/20), that is, 54 and 51. At three units apart, you will have exceeded the accuracy that can be measured by this system. You certainly won't be able to put a +-5 on your "if" stateme...

see more »

This is a great idea, and it probably works well for up to say 10 switches, which is pretty darn good.But take a closer look at the math. It looks like the values you got: 1023, 509, 338, 253, and 202are very close to: 1024, 512, 341, 256, and 205These are of course: 1024 x 1 , 1024 x (1/2), 1024 x (1/3), 1024 x(1/4), and 1024 x (1/5)The difference between consecutive values is getting smaller and smaller. IE, 1023 - 509 is about 500, but 509-338 is 171, and for your last pair, 253-202 = 52.When you extend to say 20 switches, the last two numbers will be approximately 1024 x (1/19) and 1024 x (1/20), that is, 54 and 51. At three units apart, you will have exceeded the accuracy that can be measured by this system. You certainly won't be able to put a +-5 on your "if" statement.Still, this is a great idea, and it will probably works well for up to say 10 switches, which is pretty darn good, considering you are using only one Arduino pin. But you aren't gonna get 100 switches out of it. Might be interesting to try and see how far you can get. I suspect not much more than 10.