Connection more than 20 digital pins in leonardo

So i am making a game controller and want to connect more than 20 buttons in the leonardo but a lot of them will be pressed simutaniously. any guidance on what to do ?

The answer could depend on which, how many, other details.

Don't use a leonardo!

Ok so lets be more specific

I am doing some panels for a simpit

So i have a lot of buttons that are (mom) those i will do with the one pin method in analog i can see everywhere.
But i have a lot of switches that are not momentary those how can i connect ?
when saying a lot i mean exacly

25 plus 3 rotaries with push in (so 5 min rot)

I want to use leonardo because of the HID ability. I do have a mega also but i do not see how i can use it as a game controller in my pc.

I think that you will have to bring shift registers (parallel in, serial out) into the mix.

You COULD read them on the MEGA, and transfer the 'states' to the Leonardo.

I think i will use 2 boards to be honest since that will give me the ability to take the panel apart since its a two piece one. will be simpler also.

Thanks for the imput though. Btw is there a chance i can ask one more thing

So i have an on - on switch and want to attach an led in each of the On sides. how should i go with this ?

My solution is connecting the switch normaly and then connecting the led with the 5v and resistor and ground to the switch. so when the switch turns it complete the circuit so i have my input in the arduino and completes the led circuit also.

Usually "many" momentary buttons are implemented as a multiplexed keyboard arrangement, with N pins being able to scan (N/2)2 buttons. So 10 pins would get your 25 buttons.

See Arduino Playground - KeypadTutorial

Westfw yea momentary buttons can be done like that but i want to do latching switches.

So do it in software

You will need diodes on each switch in a matrix to allow for multiple presses at the same time, so it will not matter whether you use momentary or latching switches.

Problem solved. Made everything now rotaries next.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.