# Does switching pinMode from INPUT to OUTPUT produce reliable output LOW?

**URL:** <https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845>\
**Category:** Programming\
**Created:** [November 28, 2025, 2:13pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845 "2025-11-28T14:13:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShermanP](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@ShermanP](https://forum.arduino.cc/u/ShermanP)\
**Post date:** [November 28, 2025, 2:13pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/1 "2025-11-28T14:13:55Z")

</div>

I would be driving input pins of a Lolin D1 Mini from 5V Arduino Pro Mini GPIO pins. The Lolin inputs will have pullup resistors to 3.3V enabled. It seems to me that I can switch the Pro Mini GPIOs between INPUT mode and OUTPUT mode as a form of voltage translation. INPUT would produce 3.3V on a line, and OUTPUT would produce ground. But that would depend on the IDE not doing anything funny to the output value when switching the mode. Perplexity tells me I should not rely on this because I might program it wrong. Well, yeah, but if I don't program it wrong, is there any reason I can't rely on this? If it matters, this would be for a personal hobby project, but I'd also like to know for future reference whether this is ok.

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [November 28, 2025, 2:23pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/2 "2025-11-28T14:23:59Z")

</div>

The output level (VOL, VOH) of a DPin depends on the load connected. Load shoud be such that specs of VOH and sin/source current are not violated.

---

<div class="post-metadata">

**Author:** ![gfvalvo](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/gfvalvo/32/1013044_2.png) [@gfvalvo](https://forum.arduino.cc/u/gfvalvo)\
**Post date:** [November 28, 2025, 2:54pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/3 "2025-11-28T14:54:16Z")

</div>

> [@ShermanP](#):
>
> It seems to me that I can switch the Pro Mini GPIOs between INPUT mode and OUTPUT mode as a form of voltage translation. INPUT would produce 3.3V on a line, and OUTPUT would produce ground.

I've seen a Software I2C library for AVR do that.

> [@ShermanP](#):
>
> But that would depend on the IDE not doing anything funny to the output value when switching the mode.

You can look at the source code for `pinMode()` to determine that. You could also bypass `pinMode` and use the processor's instructions to do it yourself.

---

<div class="post-metadata">

**Author:** ![herbschwarz](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/herbschwarz/32/239314_2.png) [@herbschwarz](https://forum.arduino.cc/u/herbschwarz)\
**Post date:** [November 28, 2025, 2:58pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/4 "2025-11-28T14:58:40Z")

</div>

Changing a GPIO pin to INPUT does not put a voltage on the pin. It makes the pin high impedance or floating with a variable voltage level.

---

<div class="post-metadata">

**Author:** ![JCA34F](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jca34f/32/340148_2.png) [@JCA34F](https://forum.arduino.cc/u/JCA34F)\
**Post date:** [November 28, 2025, 2:59pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/5 "2025-11-28T14:59:47Z")

</div>

Use a voltage divider, R1 = 2.2k, R2 = 3.3k.  
3.3 / 5.5 \* 5 = 3.

---

<div class="post-metadata">

**Author:** ![gfvalvo](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/gfvalvo/32/1013044_2.png) [@gfvalvo](https://forum.arduino.cc/u/gfvalvo)\
**Post date:** [November 28, 2025, 3:31pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/6 "2025-11-28T15:31:33Z")

</div>

> [@herbschwarz](#):
>
> Changing a GPIO pin to INPUT does not put a voltage on the pin.

No, but having a pullup resistor on that GPIO does.

---

<div class="post-metadata">

**Author:** ![ShermanP](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@ShermanP](https://forum.arduino.cc/u/ShermanP)\
**Post date:** [November 28, 2025, 3:31pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/7 "2025-11-28T15:31:36Z")

</div>

> [@gfvalvo](#):
>
> You can look at the source code for `pinMode()` to determine that.

Here it is. Looks like for OUTPUT mode (the final 'else' ) it only changes the direction register, which is what I would expect.

```arduino
void pinMode(uint8_t pin, uint8_t mode)
{
	uint8_t bit = digitalPinToBitMask(pin);
	uint8_t port = digitalPinToPort(pin);
	volatile uint8_t *reg, *out;

	if (port == NOT_A_PIN) return;

	// JWS: can I let the optimizer do this?
	reg = portModeRegister(port);
	out = portOutputRegister(port);

	if (mode == INPUT) { 
		uint8_t oldSREG = SREG;
                cli();
		*reg &= ~bit;
		*out &= ~bit;
		SREG = oldSREG;
	} else if (mode == INPUT_PULLUP) {
		uint8_t oldSREG = SREG;
                cli();
		*reg &= ~bit;
		*out |= bit;
		SREG = oldSREG;
	} else {
		uint8_t oldSREG = SREG;
                cli();
		*reg |= bit;
		SREG = oldSREG;
	}
}

```

> [@JCA34F](#):
>
> Use a voltage divider, R1 = 2.2k, R2 = 3.3k.  
> 3.3 / 5.5 \* 5 = 3.

Well, since the ESP8266 will have pullup resistors enabled, I think I would just need a diode - so the Pro Mini can bring the line low, but can't take it to 5V. But I would like to avoid using diodes or dividers if they aren't needed.

I guess one thing I need to check is whether the Pro Mini pins involved ever go high during an entire flashing process, and during boot. My memory is that some GPIO pins go high briefly. Well, D13 of course, but other than that.

---

<div class="post-metadata">

**Author:** ![JCA34F](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jca34f/32/340148_2.png) [@JCA34F](https://forum.arduino.cc/u/JCA34F)\
**Post date:** [November 28, 2025, 3:51pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/8 "2025-11-28T15:51:11Z")

</div>

Wouldn't the ESP input be seeing the diode's 0.7V barrier potential instead of zero volts?

---

<div class="post-metadata">

**Author:** ![ShermanP](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@ShermanP](https://forum.arduino.cc/u/ShermanP)\
**Post date:** [November 28, 2025, 4:52pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/9 "2025-11-28T16:52:31Z")

</div>

Yes it would. Per the ESP8266 datasheet, the maximum for VIL is 0.825V at Vcc = 3.3V. So 0.7V should be detected as LOW.

---

<div class="post-metadata">

**Author:** ![jim-p](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jim-p/32/922840_2.png) [@jim-p](https://forum.arduino.cc/u/jim-p)\
**Post date:** [November 28, 2025, 5:02pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/10 "2025-11-28T17:02:49Z")

</div>

> [@ShermanP](#):
>
> I would be driving input pins of a Lolin D1 Mini from 5V Arduino Pro Mini GPIO pins.

Gee, I would think that after having read more than 64 thousand post here on the forum that you would know by now that connecting 5V signals to a 3.3V only processor is a big NO NO.

---

<div class="post-metadata">

**Author:** ![ShermanP](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@ShermanP](https://forum.arduino.cc/u/ShermanP)\
**Post date:** [November 28, 2025, 5:06pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/11 "2025-11-28T17:06:14Z")

</div>

> [@ShermanP](#):
>
> I guess one thing I need to check is whether the Pro Mini pins involved ever go high during an entire flashing process, and during boot. My memory is that some GPIO pins go high briefly.

My memory was right. During a boot of the Pro Mini, the following pins go to 5V for about 1ms: D8 - D12, A0-A1. And D13, which drives the builtin LED, goes high for much longer, several times.

So I guess Perplexity was right. In theory this works, but only if you remember which pins it works for and which it doesn't.

---

<div class="post-metadata">

**Author:** ![ShermanP](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@ShermanP](https://forum.arduino.cc/u/ShermanP)\
**Post date:** [November 28, 2025, 5:13pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/12 "2025-11-28T17:13:03Z")

</div>

> [@jim-p](#):
>
> Gee, I would think that after having read more than 64 thousand post here on the forum that you would know by now that connecting 5V signals to a 3.3V only processor is a big NO NO.

Of couse I do know that. The whole point of the post was about making sure I didn't send a 5V signal to a 3.3V processor.

---

<div class="post-metadata">

**Author:** ![jim-p](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jim-p/32/922840_2.png) [@jim-p](https://forum.arduino.cc/u/jim-p)\
**Post date:** [November 28, 2025, 5:19pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/13 "2025-11-28T17:19:26Z")

</div>

> [@ShermanP](#):
>
> making sure I didn't send a 5V signal to a 3.3V processor.

I Know you must have seen this response hundreds of times, "use a voltage translator or a voltage divider."

---

<div class="post-metadata">

**Author:** ![ShermanP](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@ShermanP](https://forum.arduino.cc/u/ShermanP)\
**Post date:** [November 28, 2025, 5:21pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/14 "2025-11-28T17:21:45Z")

</div>

> [@jim-p](#):
>
> I Know you must have seen this response hundreds of times, "use a voltage translator or a voltage divider."

You continue to ignore my original question. Perhaps your time would be better spent helping someone else.

---

<div class="post-metadata">

**Author:** ![jim-p](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jim-p/32/922840_2.png) [@jim-p](https://forum.arduino.cc/u/jim-p)\
**Post date:** [November 28, 2025, 5:29pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/15 "2025-11-28T17:29:29Z")

</div>

> [@ShermanP](#):
>
> You continue to ignore my original question.

Yes, I'm totally misunderstanding what you are trying to do. I will let @GolamMostafa explain it all to you.

---

<div class="post-metadata">

**Author:** ![Dave\_Lowther](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/dave_lowther/32/1092885_2.png) [@Dave\_Lowther](https://forum.arduino.cc/u/Dave_Lowther)\
**Post date:** [November 28, 2025, 5:33pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/16 "2025-11-28T17:33:18Z")

</div>

> [@ShermanP](#):
>
> It seems to me that I can switch the Pro Mini GPIOs between INPUT mode and OUTPUT mode as a form of voltage translation

I tested that idea a while ago, results are [here](https://forum.arduino.cc/t/controlling-rasperry-pi-pin-from-arduino/1381290/10).

Then there is further discussion about how it could cause damage if a code error set the pin to output mode when it should be input.

---

<div class="post-metadata">

**Author:** ![jim-p](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jim-p/32/922840_2.png) [@jim-p](https://forum.arduino.cc/u/jim-p)\
**Post date:** [November 28, 2025, 5:36pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/17 "2025-11-28T17:36:59Z")

</div>

> [@Dave\_Lowther](#):
>
> I tested that idea a while ago, results are [here](https://forum.arduino.cc/t/controlling-rasperry-pi-pin-from-arduino/1381290/10).

I remember that, the OP wound up using a one transistor voltage translator just to be safe.

---

<div class="post-metadata">

**Author:** ![jim-p](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jim-p/32/922840_2.png) [@jim-p](https://forum.arduino.cc/u/jim-p)\
**Post date:** [November 28, 2025, 5:43pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/18 "2025-11-28T17:43:04Z")

</div>

Oh sorry, ignore my last post, I'm not supposed to be provide any further help.

---

<div class="post-metadata">

**Author:** ![gilshultz](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gilshultz](https://forum.arduino.cc/u/gilshultz)\
**Post date:** [November 28, 2025, 5:43pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/19 "2025-11-28T17:43:34Z")

</div>

# Does switching pinMode from INPUT to OUTPUT produce reliable output LOW?

No! It depends on what is connected to the pin, if it is just a volt meter and pull ups are on it should go high. If you have written a 1 to the pin it will go high. Conversely if you have written a low it will go low. Also important is if there is a load connected to the pin. For example if it is grounded it will not go high and if a high is written to it and it is placed in output mode you will stress or damage the port. I cannot give an exact answer as you have not posted a schematic.

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [November 28, 2025, 6:20pm UTC](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845/20 "2025-11-28T18:20:37Z")

</div>

> [@jim-p](#):
>
> > [@ShermanP](#):
> >
> > You continue to ignore my original question.
> 
> Yes, I'm totally misunderstanding what you are trying to do. I will let @GolamMostafa explain it all to you.

I have only understood from #1 of OP that he has connected an output line of a 5V-Pro Mini with an input line (internal pull-up active) of a 3.3V-Lolin D1.

What does he want to achieve and what is the problem he is facing? Does he physically connected the two devices together?

OP needs level shifters to connect 5V-Pro Mini with 3.3V-Lolin D1; else, one or both devices might be damaged.

[Next page](https://forum.arduino.cc/t/does-switching-pinmode-from-input-to-output-produce-reliable-output-low/1416845.md?page=2)
