Connecting a button from digital to ground?

If i have a connection from say the D5 pin, which then goes on to GND, without any resistors, will i damage my button or my photon?

@14881122, as long as pin D5 is set and an INPUT, there will be no damage. However, for pin to correctly read, you should use INPUT_PULLUP mode since the pin will “float” until you press the button, connecting it go GND.

5 Likes

Ok, thanks! I have already set INPUT_PULLUP mode, but someone i know suggested i might damage my buttons/photon by not using a resistor :stuck_out_tongue:

1 Like

That someone is correct, in case you were to run the pin as OUTPUT driving it high while shorting it down to GND.

But as already mentioned, in INPUT mode the pin will be in Hi-Z (virtually infinite resistance resulting in sourcing/sinking no current at all). And with the PULLUP/PULLDOWN “extension” to the input mode you will already have some 40k resistance applied between the respective “default” rail and the level your switch is closing to.

5 Likes