Go Down

Topic: how can I multiple switch sense on one pin? (Read 308 times) previous topic - next topic

Arty_Marty

I have a project that I am working on that has three on/off switches and I would like to read them all on one pin. (basically I have about 4 pins left so I am trying to be conservative.

I was wondering if there was a way to use a resistor on each switch, and then be able to measure that to see what combination they are either on or off...  note that I need to read them in a way that multiple switches might be on at the same time.

I would like to do it without chips, Ic's etc..,  (keep it simple)

I am having some trouble getting my head around the schmatics.  Any ideas?  

Marty
Have a look at some cool Sci-fi art and Science Fiction Sculpture by Martin Dolan here...
http://www.marty.com.au Made from scrap meta

mem

You could have your switches connect various resistors to an analog input port and use analogRead to determine which was pressed. By carefully selecting the resistor values, each switch could produce a different voltage on the input.

Grumpy_Mike

Look up the R/2R type of D/A converter and use that replacing the digital inputs with your switches. It's much better that the R, 2R, 4R, 8R type as it is difficult to get resistor values that go up in that sequence.

Go Up