Using a Digital Pin as GND or 3v3?

Is there anything wrong with setting up a pin with


and using it like GND? eg: to wire up a button?

How about the same using digitalWrite(D5,HIGH) and using it as 3v3?

It’d make my soldering easier and don’t need to be splicing wires/adding to wires to one pad/pin.


Technically it will work but it’s not advised. When the Core starts up those pins will be floating inputs. Additionally as outputs the pins can only sink and source a few milliamps, so I really wouldn’t do it!

1 Like

Would you send a schematic of what you want to do?

1 Like

Pins can sink and source 20mA I thought.

They might float at first, but setup() always runs before you user code loop() does, so you can put all of the pins in the correct state before any code is interpreting them without a problem. It should be fine.

1 Like

Which is about enough to run a single LED. It really isn’t good practice to try and power a device from the I/O pins. Personally I wouldn’t risk my Core.

1 Like

I’d say @Timb and @BDub have both their points, but the answer is neither yes nor no in general :wink:

It all depends on what you want to source/sink with that I/O pin.
As for the example @dermotos mentioned (button to GND) that’s perfectly OK e.g. when having the other side of the button connected to an INPUT_PULLUP pin or otherwise (not prefered) having the switch between a HIGH OUTPUT pin and an INPUT_PULLDOWN pin (since the input pin is high impedance anyway and the pullup/pulldown are too big to draw too much current).

But I would not drive a LED without current limiting serial resistor.

So it all depends on what current you’d expect to source/sink - that might be why @david_s5 asked for the schematic @dermotos was thinking of :wink:

1 Like

I have two buttons and two, two-axis pots. So rather than have the GND split into 4 (I’m using jumper wires, not enough space for a protoboard) I thought I could use some of the unused digital pins as GND’s for the buttons. I’m not driving anything from these. From the answers (and my experience) its seems like its ok. thanks!