I have an Arduino set-up in which I need a few more pins than the Arduino Leonardo can provide. Specifically, I have three digital pins available, but require 5 digital pins. Of those 5 pins, three will be used as digital inputs for switches, and two will be used as digital outputs for LEDs.
I'm not particularly familiar with muxing-demuxing. Is it possible to use a single 4051 as both digital input and digital output? Or can it only be used either as digital input or as digital output?
I also have a CD4021BE available...perhaps this would be a better choice?
Arduino-x:
Is it possible to use a single 4051 as both digital input and digital output? Or can it only be used either as digital input or as digital output?
But you would be a fool to use it for outputs because you need to rapidly multiplex to keep it from appearing that the LEDs are flashing.
If you require extra pins then use a port expander or shift register.
Grumpy_Mike:
But you would be a fool to use it for outputs because you need to rapidly multiplex to keep it from appearing that the LEDs are flashing.
Grumpy Mike, I'm glad you mentioned the flashing problem.
If I re-worked my circuit, I could organize it such that the shift register would handle only digital outputs (specifically LEDs). Would the 4021 shift register that I mentioned in my original post be a suitable choice? Or would you recommend something else?
The 4021 has only three digital outputs. These are not latched so when you use them you can get flicker as the outputs change. If that is acceptable then fine.