# Pressing/activating a push button logically?

**URL:** <https://forum.arduino.cc/t/pressing-activating-a-push-button-logically/1207486>\
**Category:** Programming\
**Created:** [January 5, 2024, 5:49pm UTC](https://forum.arduino.cc/t/pressing-activating-a-push-button-logically/1207486 "2024-01-05T17:49:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![matrixIII](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/matrixiii/32/1013044_2.png) [@matrixIII](https://forum.arduino.cc/u/matrixIII)\
**Post date:** [January 5, 2024, 5:49pm UTC](https://forum.arduino.cc/t/pressing-activating-a-push-button-logically/1207486/1 "2024-01-05T17:49:18Z")

</div>

I have an external circuit board that is powered by 3v. It has a physical push button that I would like to push/activate logically. One side of this button has ground, when the button is pressed the other side is connected to ground and the circuit completes.

Now using an arduino, I know it might be easier to do this using a relay, transistor or optocoupler but I am trying to do this without any other components - is it possible?

I can connect one of the Arduino GPIO5 pin to the button and then do

```arduino
pinMode(5, OUTPUT);
digitalWrite(5, LOW);

```

The above will work but the big question is when I do digitalWrite(5, HIGH) which essentially would be the rest state of the GPIO5 denoting that the button is not pressed, wouldn't this send a +3v causing a short circuit?

![arduino-circuit](https://europe1.discourse-cdn.com/arduino/original/4X/9/9/e/99eff67a1d8acec0725289df5f936a2ff10fd2bc.jpeg)

---

<div class="post-metadata">

**Author:** ![PaulRB](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulrb/32/216330_2.png) [@PaulRB](https://forum.arduino.cc/u/PaulRB)\
**Post date:** [January 5, 2024, 7:37pm UTC](https://forum.arduino.cc/t/pressing-activating-a-push-button-logically/1207486/3 "2024-01-05T19:37:49Z")

</div>

> [@matrixIII](#):
>
> Now using an arduino

Would you care to share what model of Arduino? They are not all the same, you know?

---

<div class="post-metadata">

**Author:** ![matrixIII](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/matrixiii/32/1013044_2.png) [@matrixIII](https://forum.arduino.cc/u/matrixIII)\
**Post date:** [January 5, 2024, 8:46pm UTC](https://forum.arduino.cc/t/pressing-activating-a-push-button-logically/1207486/5 "2024-01-05T20:46:50Z")

</div>

> [@Delta\_G](#):
>
> Only if you press that button at the same time and connect it also to ground.
> 
> A 1K or so resistor in the line between the GPIO and the other device could remedy that.

Ah, makes sense!

---

<div class="post-metadata">

**Author:** ![matrixIII](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/matrixiii/32/1013044_2.png) [@matrixIII](https://forum.arduino.cc/u/matrixIII)\
**Post date:** [January 5, 2024, 8:48pm UTC](https://forum.arduino.cc/t/pressing-activating-a-push-button-logically/1207486/6 "2024-01-05T20:48:12Z")

</div>

> [@PaulRB](#):
>
> Would you care to share what model of Arduino? They are not all the same, you know?

I don't think it matters for the context of the question? (I don't have a specific board that I am using yet)

---

<div class="post-metadata">

**Author:** ![PaulRB](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulrb/32/216330_2.png) [@PaulRB](https://forum.arduino.cc/u/PaulRB)\
**Post date:** [January 5, 2024, 9:25pm UTC](https://forum.arduino.cc/t/pressing-activating-a-push-button-logically/1207486/7 "2024-01-05T21:25:34Z")

</div>

> [@matrixIII](#):
>
> I don't think it matters for the context of the question?

I know it does.

If you choose a 5V Arduino and connect it's GPIO pin to the input of a 3.3V device, the device could be damaged.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 3, 2024, 9:25pm UTC](https://forum.arduino.cc/t/pressing-activating-a-push-button-logically/1207486/8 "2024-07-03T21:25:38Z")

</div>

Closed on July 3, 2024, 9:25pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
