user77175: I know this sounds simple, but I have an Arduino Mega 2560 and I am making a matrix keypad for a claw machine. It's a 3*4 matrix keypad. Let's just say, I am making this keypad for the claw machine to reduce the number of I/O pins. I have tried to use a mux, but that has failed me because it has a single input/output pin and can only read ONE button at a time. So, I have come up with the solution to use a matrix keypad because: A. It is the most common method and B. It is smaller on a PCB design rather than that CD4067BE chip. The reason why I was trying to use that chip in the first place was because it included all my thirteen buttons. Basically, what I am wanting to know is if I should use a resistor or an LED to stop either "floating" or "ghosting." I still don't really know the difference between the two terms, but if somebody could clarify that, that would be great. And also when I should use an LED or a resistor. Or do they serve the same purpose? Tutorials: LED "ghosting" Pullup Resistor "floating" (I am not sure how to make a schematic of the "floating" pin).  (Credit to EasyEDA for the schematic). Thanks,
Austin

user4143: First some clarification:

Floating is where an input isn't connected to a defined logic state. It's neither in one state or the other and is free to "float" between them at will. Basically a floating input is an antenna.
Ghosting is where you press two buttons in a matrix together and it causes unwanted short or crossed circuits in the matrix making it appear that other keys are pressed when they aren't.

The Keypad.h library deals with any pullups that may be needed.  To prevent ghosting you need to use diodes (not LEDs) to separate the buttons from each other.
Nick Gammon has a fantastic tutorial where he describes the problems and solutions to ghosting.

77175: <p>I know this sounds simple, but I have an Arduino Mega 2560 and I am making a matrix keypad for a claw machine. It's a 3*4 matrix keypad. Let's just say, I am making this keypad for the claw machine to reduce the number of I/O pins. I have tried to use a mux, but that has failed me because it has a single input/output pin and can only read ONE button at a time. So, I have come up with the solution to use a matrix keypad because: A. It is the most common method and B. It is smaller on a PCB design rather than that CD4067BE chip. The reason why I was trying to use that chip in the first place was because it included all my thirteen buttons. Basically, what I am wanting to know is if I should use a resistor or an LED to stop either &quot;floating&quot; or &quot;ghosting.&quot; I still don't really know the difference between the two terms, but if somebody could clarify that, that would be great. And also when I should use an LED or a resistor. Or do they serve the same purpose? Tutorials: <a href="https://www.baldengineer.com/arduino-keyboard-matrix-tutorial.html" rel="nofollow noreferrer">LED &quot;ghosting&quot;</a> <a href="https://www.build-electronic-circuits.com/pull-up-resistor/" rel="nofollow noreferrer">Pullup Resistor &quot;floating&quot;</a> (I am not sure how to make a schematic of the &quot;floating&quot; pin). <a href="https://i.stack.imgur.com/p6psk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p6psk.jpg" alt="Schematic for the project" /></a> (Credit to EasyEDA for the schematic). Thanks,</p>
<p>Austin</p>
 4143: <p>First some clarification:</p>
<ul>
<li>Floating is where an input isn't connected to a defined logic state. It's neither in one state or the other and is free to &quot;float&quot; between them at will. Basically a floating input is an antenna.</li>
<li>Ghosting is where you press two buttons in a matrix together and it causes unwanted short or crossed circuits in the matrix making it appear that other keys are pressed when they aren't.</li>
</ul>
<p>The Keypad.h library deals with any pullups that may be needed.  To prevent ghosting you need to use diodes (<em>not</em> LEDs) to separate the buttons from each other.</p>
<p>Nick Gammon has <a href="https://www.gammon.com.au/forum/?id=14175" rel="nofollow noreferrer">a fantastic tutorial</a> where he describes the problems and solutions to ghosting.</p>
