Does keypad library require diodes?

Does the keypad library ( require diodes on the switches?

You won't need external resistors or diodes because the library uses the internal pullup resistors and additonally ensures that all unused column pins are high-impedance.

I see why I wont need external resistors, but does the "no diodes" apply only on pre-manufactured kaypads? I am planning to make my own matrix for input switches and now the question is if all the diodes are required or not:

Diodes are not required. What the library basically does is have all the column lines high. It then brings 1 low, and reads the row pins. If a low is seen, it knows the active column, and now the row, so it knows whic button was pressed. Then on to the next column...

Thanks for your reply, but my question is: What happens if 3 buttons in a rectanble are pressed? Normally the arduino would report 4 buttons then if I don't use any diodes?! Or does this library go around this problem somehow? Hope you do understand what I mean ;)

I don’t have a keypad set up at the moment. It likely just reports the first one it reads. Try it & see.

MD5003: Or does this library go around this problem somehow?

Sadly, not yet. As soon as they improve quantum computers I should be able to nail it. ;)

To be clear, you are correct. The problem you are talking about is called ghosting. The default settings for the library allows 10 keys to be pressed at the same time but you will need diodes if you need to avoid ghosting.

If I will not press or hold two or more keys same time in Matrix-keypad. Do I need diodes with all keys????

No, you won't need them. Ghosting occurs when more than one button is pressed at the same time. Diodes are only needed where more than one button is pressed at the same time.

Actually, diodes are needed when you need to reliably determine more than two simultaneous key-presses.

Two is never a problem. Three is only a problem when they share two columns and two rows.