I am trying to understand why connecting, say, an Arduino digital pin 4 to a 2N4401 pin 2 as well as 5V PSU to 2N4401 pin 1 and Arduino VCC to 2N4401 pin 3, won't keep power.
When shorting pin 1 and pin 3 on the 2N4401 the MCU is powered on and in-software pin 4 is set to pinMode OUTPUT and HIGHwhich should allow the 2N4401 to let power flow to the MCU for as long as power is available even when the short circuit between 2N4401 pin 1 and 3 is cut. 2n4401 pdf:www.kynix.com/.../2N4401BU.pdf Instead what happens when the short between pin 1 and 3 is cut, the MCU is turned off instantly.
It's as if the transistor isn't reacting to the pin 4 MCU signal at all.
Could anyone explain why this is happening?
I'm sure I lack a lot of knowledge here and I want to know how I could utilize a 2N4401 to make a SW shutdown system.
Why 2N4401? Why not a MOSFET? MOSFET's circuits that do SW shutdown are available, but no transistor base SW shutdown circuits are to be found anywhere, and the 2N4401 is all that I have right now.
I wasn't talking about the processor - I was talking about the pin numbers for the transistor: "to a 2N4401 pin 2 as well as 5V PSU to 2N4401 pin 1 and Arduino VCC to 2N4401 pin 3"
Way easier to talk about base, emitter and collector when talking about how a NPN/PNP transistor is connected.
What it has to do with Keil? The OP suspects he is doing something wrong with the I/O pin of the processor while not realizing he is missing how a NPN transistor behaves.
Which, of course, has nothing to do with Keil!
Perhaps this might help:
electronicsclub.info/transistors.htm
electronicsclub.info/transistorcircuits.htm
Or any of the many other basic electronics tutorial websites & books available...