A small current or voltage at the base allows a larger voltage to flow through the other two leads (from the collector to the emitter). The circuit shown in diagram B is based on an NPN transistor. When the switch is pressed a current passes through the resistor into the base of the transistor.