Shift regester question

Good day all

I am new here.

I am busy with a project where I use shift register's

I need to use them for input and output.
For output I use the 74HC595 and input the CD4021BE which I need to daisichain.

I would just like to know if there are a way to use both in and out registers and share pins.
ie share the clockpin on both regesters alowing a spare pin on my arduino.

The shift out will also be used for pwm usning the shiftpwm libary.

Any info will be apreciated

Limited experience of this, but I think you'll have no problem sharing the data and clock pins.

You'll probably need to keep the latch pins separate - one for the input (4021), one for the 595(s). When you read the inputs from the 4021, that same data will be getting streamed out to the 595s at the same time (if you're sharing pins) but as long as you don't touch the 595 latch pins, it'll be safely ignored and won't affect your outputs.

You'll need to change the pinMode of the data pin (from INPUT to OUTPUT or vice versa) depending on whether you're reading from the 4021s or writing to the 595s but I don't think that'll have any unwanted effects elsewhere as long as you're careful to only latch the output data when you mean to.