4067 button array to 595 led shift register

Hello!

I would like to use a 4067 to multiplex 16 buttons. The mux-array will be used to send midi data to a computer and also to light up a led for each button which is pressed. I must be able to press multiple buttons at the same time and 16 leds must be able to light up at the same time as well.

My question is how I should make the code, since I’ve read the whole google by now and still don’t find any similar project. I understand how to solve the 4067 and the 595 separate, but how do I combine them?

I use a bool to gather information about “buttonState”. Can I send a bool array to the 595’s or do I need to translate it to byte or anything else? I will use two 595 chips in cascade mode.

It would be so helpful to see a complete code from button to led for me right now. So do you know about any similar project or know why there isn’t, an explanation is much appreciated, thanks!

I can post some code tomorrow if necessary. Just tell me if you need some more information.

I understand how to solve the 4067 and the 595 separate, but how do I combine them?

Simple, take the input from the 4067, and use it to set bits in the int variable you send to the 595 chain.
You can use the bit read and bit write instructions or use grown up logic operations.

It would be so helpful to see a complete code from button to led for me right now.

You mean you want someone to do it for you?

know why there isn't, an explanation

Maybe because it is a bit trivial.

Thanks Grumpy_Mike!

Nice to hear that it is simple at least, I thought for a while I’ve missed out on something. Good advices, I will take a look at that.

No I don’t really want anyone else to do it for me, to understand stuff you sometime need to see a tutorial or an example of something. There is hundreds of examples on how to solve 595 and 4067 separate, but I got a bit worried when nobody had used them together and posted a project about it.

Ofcourse it’s trivial for a professional. Everything is trivial for those who knows.

Do any professional know if I need to ground the pins on the 595 if I don’t connect any leds to them while prototyping? I know the 4067 wants it when no button is connected to not float..

Is there btw any possibilities to not use a resistor before the led on the 595 side?

Is there btw any possibilities to not use a resistor before the led on the 595 side?

No.

Do any professional know if I need to ground the pins on the 595 if I don't connect any leds to them while prototyping

You do not need to connect them to anything.

If you get stuck doing this the. Post your code using the IDE’s copy for forum option, and we can guide you through the process.

Is there btw any possibilities to not use a resistor before the led on the 595 side?

Yes, by swapping your two 595 for a single 16 Channel Constant Current Led Driver such as DM13A, STP16CP05 or TLC5928. Your code probably won't even need to be altered and one resistor sets the current for all 16 LEDs.