More specifically, with a direct connection (no resistors) you start by putting "digitalWrite(pin, LOW);" in setup(), then whenever you want to 'press' the button, you use "pinMode(pin, OUTPUT);" and "pinMode(pin, INPUT);" to 'release' the button.
And possibly more to the point, it would feed 5 V from the Arduino into the 3.3 V system. Not good! ![]()
You can however put a diode with cathode to the Arduino and anode to the switch (grounds always connected together of course) which protects against all mis-programming. Of course if the Arduino was not powered, it would appear as a button press.
I don't have the time to educate you on PNP/ NPN. ![]()