If I have two output pins, one set high and the other set low with digital or analog write like this

digitalWrite(PIN1, LOW);
digtialWrite(PIN2, HIGH);

and then I short them together using a wire, will current flow through the wire?

  • will current flow through a wire if you connect the positive and negative terminals of a battery?
    – jsotola
    Commented May 4, 2020 at 3:44
  • 3
    Oh yeah. So a large amount of current will flow which could damage the arduino.
    – Mark
    Commented May 4, 2020 at 3:55

4 Answers 4


Yes. It is dangerous. You can imagine what would happen when you understand how a GPIO pin works in output mode.

You are effectively connecting VCC to GND via two small and weak MOSFETs which will overheat and break down.


You can connect but requires resistor between two pins to limit the current.

  • It depends on what you try to achieve. If you want to demonstrate what happens without a resistor, and you're ready to accept possible damages, you can connect two output pins directly, and drive different levels. Commented May 4, 2020 at 8:22

That's out of spec for any arduino microcontroller.

The behavior of a broken Arduino is "undefined" :)

I guess there will not flow current (after an initial peak), but at least one of the two pins is not working properly any more. But, this is just a guess.

And it's probably not dangerous for you or the connecting wire (Other than @jsotola's comparison with a shorted battery in a comment to your question). I guess the arduino will die before it gets dangerously hot.


Shorting the output pins together is a bad idea that will likely result in damage to your Arduino. According to specifications, the I/O pins are able to source (provide current to a load) or sink (accept current from an external source) up to 40mA. In almost all cases, you will want to use a current-limiting resistor. In some cases, an external circuit that you connect your Arduino to may intrinsically limit the current.

In the case of lighting up an LED, you can do this in two ways:

  • Set the I/O pin HIGH to source current to the LED through a current-limiting resistor to ground. The I/O pin provides the current to light up the LED. LOW turns it off.
  • Set the I/O pin LOW to sink current from the LED and current-limiting resistor where the power to the LED is provided by the external source. In this case, the LED floats and the I/O pn serves as ground. HIGH turns it off.

The internal pullup resistor is useful if you want to be able to drive an external transistor or logic level device.

This Arduino tutorial goes into more detail about the specific modes of operation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.