if like me your into electronics and use micro controllers you will know that they have a very limited number of port lines
sometimes a project requires just 1 or 2 more lines than the chip has and you end up buying the next device up to gain just a few lines (not cost effective)
if your project uses a few push buttons inputs its possible to save input lines buy putting all switches on just 1 i/o pin saving a lot of port lines !
4 buttons shown but you can add as many as required
the software to read these switches is very simple and based on a counter
Code: Select all
set port pin for output and output a logic 0 to discharge capacitor
zero counter
set port pin for input
repeat
counter++
until (port input = 1) or (counter = max timeout)
hope you found this helpfull
btw if you remove the resistors and switches and replace with a variable resistor you have a way of measuring analogue control position