In a pushbutton what Wire connect to Arduino?

I have assembled on protoboard a pushbutton. I ser vaious tutorials about pushbutton but Im in doubt about what Wire plug to Arduino.Will it be orange or brown?


Well it depends, should the Arduino just read the button or should it read the button and output to the led using the Arduino?

If it’s the first option, then any of the digital or analog pins will work as inputs to read the button.

If it’s the second option, then you will need to tell the Arduino to read the button on one pin (Example: A0) then output that signal on another pin (let’s say D3, skipping D1 and D2 as they are used for the serial monitor, just in case you want to see what the Arduino sees) to the led.

You can really use any of the digital or analog pins for this as either an input or output to suite your needs.

Pins with ~ next to them can be used to send pulse width modulated (PWM) square waves on them. This can be used to change the brightness of the led if you want.

Second options. I placed The LED's on The picture just for continuity test. To BE more ckear about my doubt orange Wire hás placed after resistor and The brown(in The picture appears with some Yellow tone, but Im refering that is on The right closest Leaning against orange) Before. Im in doubt if i need to pass The sinal on resistor (só use orange) or not.

Post a schematic to see how we can help.

A picture is worth 1000 words.

1 Like


Here's The schematic. Sorry but i havent any coloured pencil or pen, so i writed The colours in The picture

The more acceptable way to wire a switch is to wire one side to ground and the other side of the switch to an input with its pinMode set to INPUT_PULLUP. No external resistor needed. The input will read HIGH when not pressed and LOW when pressed. If the switch has 4 terminals, wire to diagonal terminals to avoid a short circuit.

External pullup test with led to check if The signal are righ


Burton pressed

Not pressed

Just One more doubt Now os just plug The white Wire to Arduino?

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