Add another 16 pins to your microcontroller using a MCP23017 port expander. The MCP23017 uses two i2c pins (these can be shared with other i2c devices), and in exchange gives you 16 general purpose pins. You can set each of 16 pins to be input, output, input with a pullup or open drain. There's even the ability to get an interrupt via an external pin when any of the inputs change so you don't ...