Bi-directional shift register with clickbutton library or similar

Perhaps rather than labelling this topic "bi-directional shift register with click button library or similar" I should have explained what I'm actually trying to do, but I couldn't think of a better title at the moment!

I'll split this into two questions;

1/ I have 5 LEDs and 8 momentary push-button switches, but can't afford to dedicate an Arduino pin to each. Do I need to use 2 shift registers, one for the switches and one for the LEDs? Or is there such a thing as a bi-directional shift register (saving components and pins)?

2/ I'm currently using the "clickbutton" library which handles switch debounce, single click, double click, triple click, long click, and various permutations of the above. Does anyone know of a library that can be used to integrate such functionality with a shift register? Correct me if I'm wrong but the clickbutton library interfaces directly with switches on pins rather than allowing multiple click detection from serial input.

Can also consider using separate electronics e.g. 555 timer and logic to achieve part of the above, but would rather avoid having to add extra components to my board.

If anyone knows of a hardware / library combination that could tie the above together I'd be really interested!

Hi hazymat,

Yes, there does indeed exist the type of bi-directional shift register you describe. They are called i2c i/o expanders. The most common kind is PCF8574.

Paul

@PaulRB

Thanks, really helpful.

Does anyone know of a way to implement multiple-click (double click etc.) on pushbutton using an i2c i/o expander?

Many thanks

Mat

Yes, I don't see a problem with counting multiple clicks. The fact that the button is attached to the I/o expander makes no difference in principle. Its just slightly more complex code instead of digitalRead.