One led for 18 buttons

Hello everyone, I would like to turn on a single LED every time I press one of the 18 buttons, since I have no more pins available, I wanted to opt for the simplified scheme but before proceeding I would like to ask the experts if it is possible

Thanks!

Please flesh this out a bit more.


Also, what happens if two or more switches are operated ?


Always show us a good schematic of your proposed circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.

1 Like

What arduino? UNO, Mega......?

Hello useus

Take search engine of your choice and ask the WWW for 'Diode-Resistor-Logic'.

Logically, 1 output and 18 OR gates input gates.

OR gates | TI.com

https://upload.wikimedia.org/wikipedia/commons/6/6e/Animated_wired_OR_diode_logic.gif

I try to reply to everyone with a message

Arduino pro micro

The buttons simulate some keyboard keys, so each button pull down resistance on the 18 pins.

I searched diode resistor logic but I didn't understand very well

Diode OR gate

So the scheme is ok?

Yes

Thanks!

Why did you not connect your buttons as a matrix? Then, only 9 pins instead of 18 would be needed. That means plenty of pins for LEDs.

To create the matrix I would have to rewrite most of the code.

I should have found the solution using one of the unused pins of atmega32u4. I'll give it a try as soon as I can

Sounds like you could benefit from a code review. Post it here and the forum can suggest ways to improve it.

But you said

?

Hidden pins soldered direct to mcu

In theory they are 5 pins (12 26 32 40 41) + two pins of the leds on the pcb

I tried the scheme that I published in the first post and it works, I leave everything as it is just fine.

thank you all!

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