Electronic – arduino – Trigger led with both Arduino and tactile button

arduinoswitches

I want to trigger a LED with both an Arduino and a hardware switch without coding any button logic in the Arduino.

schematic

simulate this circuit – Schematic created using CircuitLab

When the button is pressed there is a direct connection between the 5V power supply and Arduino pin 17. Can this do any harm? Is there a better solution?

Best Answer

What you have drawn is a bad idea. If the Arduino output is low when the button is pressed, the 5V bus will be shorted. That's really bad. Instead, do something like this.

schematic

simulate this circuit – Schematic created using CircuitLab