Hi,
With this solution you need:
2 data input at the microcontroller (wired to the ´151 "Y" outputs)
3 select output at the microcontroller (wired in parallel to the S0, S1, S2 inputs of the ´151)
(= 5 pins in total)
2 pieces 74HC(T)151
... for sure you need to "toggle" the Select pins. in this way:
* select 000 (bin)
* wait a little time for the signal to settle
* read the input(s)
* select 001 (bin)
* wait...
* read...
* and so on
***
Using a I2C port extender needs just 2 uC pins (SCL, SDA) and has several benefits like: individually selectable input or output, interrupt on pin change, standard interface, software library, ...
Klaus