Transistors are electronic components that behave like a switch, or amplifier.

Schematic

        .--.,-- Collector
Base --(--|<)
        `--`'-- Emitter

Examples

Switch

If the base pin is provided with energy, the transistor allows current to flow in the main circuit.
image

Amplifier

Altering the voltage given to the base pin allows us to control a larger voltage in the main circuit.
image1

Types of Transistor

NPN

An NPN transistor combines the base pin and collector pin.
image2

Note: Even if the collector pin is disconnected from the circuit, a small amount of current still passes through. image3

PNP

A PNP transistor receives energy through the emitter pin, and then divides it to the remaining pins.

image4