dc42 - All 11 ATtiny pins are in use - 4 go to a TLC5916 (latch, clock, data, enable), 2 go to an i2c device, 1 goes to an on/off pushbutton, and the remaining 4 go to this DIP switch array. I'd never seen diode multiplexing before either; thanks for introducing that to me as well. I'll keep that in mind for future projects.
With that setup, you could indeed use diode multiplexing, like this:
- Connect your 8 dip switches plus the pushbutton in a 3x3 matrix, with a diode in series with each switch or pushbutton.
- The three rows connect to 3 input pins (3 of the 4 pins you are currently using for reading the dip switches). Enable the internal pullups on those pins.
- For the three columns use the 4th of those pins, the pin you were using for the pushbutton, and the pin providing the data connection to the TLC5916.
To read the switches, drive one column low at a time, then read the 3 inputs to see which of them read low.
However, it's not much of a component saving - 9 diodes rather than 12 resistors. One advantage is that reading the DIP switches will be faster because you don't have to make analogRead calls, however, that may not matter unless you are reading them frequently.