Think of a transistor as a voltage- or current-controlled switch inserted in series with your load. One terminal, called the control terminal, accepts a small input signal. The other two terminals, the load terminals, form the path through which load current flows. When the control signal is below a threshold, the switch is open and essentially no current flows through the load. When the control signal exceeds the threshold, the switch closes and current flows freely.
This is the pattern used throughout embedded systems: the GPIO pin is on the control side and carries only microamps to milliamps, while the load side carries whatever current the load requires, which can be far more than the STM32C031C6 could ever supply. The two sides share only a ground reference; their current paths are otherwise independent, and the load can be powered from a separate supply entirely if needed.
Figure5.1.1.Left: a mechanical switch in series with a lamp and battery. A finger supplies the control force; the switch must carry the full load current. Right: replacing the mechanical switch with a transistor. A small control circuit on the left (the GPIO pin in practice) drives the transistor’s control terminal, which switches the full load current on the right, with no moving parts and no physical contact between the two circuits.