This is how I would do it:
- Connect the common (C) pin to +5v
- Connect the 4 other pins to PORTB.4-PORTB.7
- Use 10k resistors to pull each of those pins to ground.
Now all you have to do is this:
some_variable = ( PORTB & $F0 ) >> 4
now, some_variable should be equal to the position of your switch.
Bookmarks