# Push Button Wiring official guide question

**URL:** <https://forum.arduino.cc/t/push-button-wiring-official-guide-question/1110566>\
**Category:** General Electronics\
**Created:** [April 3, 2023, 6:19pm UTC](https://forum.arduino.cc/t/push-button-wiring-official-guide-question/1110566 "2023-04-03T18:19:43Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [August 28, 2023, 10:12pm UTC](https://forum.arduino.cc/t/push-button-wiring-official-guide-question/1110566/4 "2023-08-28T22:12:46Z")

</div>

There's a schematic demonstrating the several ways to wire the button and ranks the options:

[![](https://europe1.discourse-cdn.com/arduino/original/4X/7/e/0/7e0ee1e51f1df32e30893550c85f0dd33244fb0e.jpeg) ](https://europe1.discourse-cdn.com/arduino/original/4X/7/e/0/7e0ee1e51f1df32e30893550c85f0dd33244fb0e.jpeg)

Does someone have the canonical link to this diagram and any discussion around it? (ETA: [Share tips you have come across - #999 by LarryD](https://forum.arduino.cc/t/share-tips-you-have-come-across/428745/999) -- There's some discussion there and at [https://forum.arduino.cc/t/wiring-a-button-pull-down-bad-vs-input-pullup-best/116298566](https://forum.arduino.cc/t/wiring-a-button-pull-down-bad-vs-input-pullup-best/116298566) )

The Arduino tutorial chooses the BAD S1 wiring:

 ![](https://europe1.discourse-cdn.com/arduino/original/4X/c/2/1/c2113a419c23f222dd04fefc0f45c29b712c4373.png)  
The danger I see in the tutorial's circuit is that any code run on the circuit with a line like:

```cpp
    pinMode(2,OUTPUT);

```

would, when the button is pressed, short the 5V to ground through the Arduino, potentially sinking more than the 40mA limits on pins.

Here's some code that, if properly edited, could demonstrate the hardware vulnerability of pull-down button wired Arduinos to malicious software:

```cpp
void setup(void) {
  for ( int i = 0; i <= NUM_DIGITAL_PINS ; ++i) {
    // pinMode(i, 0UTPUT) // smoke-test for non-current limited 5V inputs
  }
}

void loop(void) {
}

```

Maybe the pull-down tutorial advice helps sell replacement Arduinos?

ETA: Nick Gammon has a tutorial:

> **[Gammon Forum : Electronics : Microprocessors : Switches tutorial](http://www.gammon.com.au/switches)**
>
> Gammon Forum : Electronics : Microprocessors : Switches tutorial

---

_[View the full topic](https://forum.arduino.cc/t/push-button-wiring-official-guide-question/1110566)._
