GPIO pins are not power drivers
STM32 GPIO pins can drive small loads, but each pin and port has current limits. Exceeding them can cause voltage drop, heating or damage.
LED resistor calculation
For LEDs, current is set by GPIO voltage, LED forward voltage and series resistor. Use conservative current values for reliability.
Total port current
Multiple pins switching current at the same time can exceed port limits even if each pin looks safe individually.
When to use a driver
Use a transistor, MOSFET or driver IC for motors, relays, LED strips, high-current LEDs or external loads.