I'm quite green, but as a gentle venture beyond the basic tutorials, I'm creating a very simple game with an Arduino Mega. The game sketch is working fine; it sets an array of pins to INPUT_PULLUP and then asks the player to make moves that connect wires in a certain sequence, and I can see if the pins were connected correctly by the resulting high or low as I iterate over the pin array with digitalRead.
My question is: should I be worried that someone playing the game might accidentally connect 2 digital inputs together, rather than the expected connection to ground? One of these inputs could, at any given time, be grounded or not. I've seen plenty of warnings about the follies of connecting 2 output pins, but couldn't find similar warnings about digital inputs. I apologize that my fundamental electronics knowledge is still at such a basic level that I haven't been able to answer this by my own reasoning or research. Thank you in advance for your time and help
Nothing bad will happen if you connect 2 input pins, even if one or both are set to input pullup. The internal pullup resistors are 30K to 50K so they pass very little current when an input is connected to ground.
2 outputs connected can cause damage if one is high and the other low, so don't do that.
If you are only setting pins as INPUT_PULLUP, and then reading if the player connects a pin to Gnd or not, then you are not using any outputs and there will be no issue.
Inputs can be connected to already grounded inputs with no issue.
groundFungus:
Nothing bad will happen if you connect 2 input pins, even if one or both are set to input pullup. The internal pullup resistors are 30K to 50K so they pass very little current when an input is connected to ground.
2 outputs connected can cause damage if one is high and the other low, so don't do that.
How? According to the Atmega datasheet, a digital pin can source or sink 40mA, so how would connecting an output high to an output low harm anything?
True ..... the internal impedance of the output (in output mode of operation) is relatively low. So if one output pin is set to output a high voltage while the other output is set to a low voltage, then it is pretty much a short circuit situation. High current flow, and undesirable device damaging situation.