3 buttons

hello,

I had 3 buttons connected to Ardunino according to proposed schematic:

Unfortunately now I have only 2 output channels available so I want to use 01, 11, 10 signals for determining which button was pressed.

Can I connect buttons according to schematic:

Thanks!

Yes, you can. The button 11 is the same as simultaneous press of 01 and 10.
If you are out of I/O, consider to use analog pin read with AD conversion for more buttons on same I/O with different resistors.

Yes you can, but not that way.

Mistake 1: the wire on the second button just shorts pins 2 and 3. Use two diodes :wink:

Mistake 2: the top and bottom pins of the button are the same. When pressed, it connects left to right. Aka, pins 2 and 3 now are just connected to Vcc.

Tips 1: You can do that but do know you can't distinguish a button 2 press from button 1 and 3 pressed at the same time.

Tip 2: Drop the resistors and connect the buttons between a pin and GND. Enable the internal pull ups with pinMode(pin, INPUT_PULLUP)

I cannot use analogue, @Budvar10, because my device does not have it, and tinkercad has only arduino uno for sketches.

I am aware of the problem described by @septilion "Tips 1" and could probably fix it using some gate logic, e.g:
ONLY_1 = (1 XOR 3) AND 1
...but this would complicate the schematic and I count on user's (myself) common sense. :slight_smile:

I have fixed mistakes and simplified my design as suggested by @septilion in "Tip 2":

Can someone please suggest what diodes should I use for this purpose?

1n4148 and turn them 180 degree :wink:

@analog, I don't know why you can't use that... The Uno has it :slight_smile: And you can make voltages with resistors and buttons. But if you just need two this is a great solution.

A third no external component option would be to put the third button between pin 2 an 3. But then you need to pool it by making one of the two low for for a short period and check if the other pin only becomes low for that same period. More work in software but except the buttons a zero hardware solution.