Since you are into patterns, let's discuss a few.
There is the pattern of an LED, where the voltage source might be anything.

simulate this circuit – Schematic created using CircuitLab
In this design pattern, you only need to calculate the value of \$R\$, knowing the intended LED current, intended LED voltage at that current, and the voltage of the supply (or the voltage difference between the two nodes at top and bottom.) Here the equation is:
$$R=\frac{V-V_\text{LED}}{I_\text{LED}}$$
The choice as to which is first, resistor or LED, doesn't matter. The pair makes up a functional block.
Then there is the pattern of an MCU controllable series switch.

simulate this circuit
Here, you have the options of using a BJT or MOSFET for the series switch. The use of the series switch means that either the circuit is enabled or disabled, but not bypassed (see later.) Note that the switch is either on the "low side," meaning it is attached to ground and when enabled connects the load to ground when enabled; or else it is on the "high side," meaning it is attached to the (+) power supply rail and connects the load to that supply rail, if enabled.
If the \$+V\$ rail is different (higher) than the MCU's own \$V_\text{CC}\$ rail, then the low-side pattern is usually attempted. (This is because the high-side pattern can't be turned fully off when the \$+V\$ rail is higher.) In other cases, either approach probably will work okay.
The value of the base resistor, when the BJT form is selected, is:
$$R_\text {B}= 10\cdot \frac{V_\text{CC}-700\:\text{mV}}{I_\text{LOAD}}$$
\$ I_\text{LOAD} \$ is just \$ I_\text{LED} \$ if an LED is the load.
In this pattern, the first pattern of just powering an LED properly can be applied as the load. (The only issue being that the series switch itself has a slight voltage across it. So this added voltage must be subtracted from the earlier equation's numerator (for the LED current limit resistor) before calculating the resistor value. Usually, this isn't much of a difference, so the same resistor works fine.)
Then there is the pattern of an MCU controllable bypass (parallel) switch. (For this pattern, I'll focus on the low-side switching pattern discussed above. Similar, would apply in the high-side case.)

simulate this circuit
In this case, you must have a load that can be divided in half. Pattern 1 is such a load and shows up here split into two parts.
Here, the value of the base resistor in the BJT case is:
$$R_\text {B}= 10\cdot R\:\frac{V_\text{CC}-700\:\text{mV}}{ V_\text{CC} }$$
The use of the parallel switch means that the current that would otherwise go through the object of interest (the LED here) is bypassed through the switch, instead.
Note that in this case the current isn't turned off, ever. It either is allowed to proceed through the LED or else it bypasses the LED and goes through the switch. Either way, the current takes place. (In fact, since the switch often has a lower voltage across it than the LED, the resistor shown will actually increase its current when the switch is bypassing the LED.)
The main point here is that the transistor switch (BJT or MOSFET) must have a very low voltage across it, so that the load (LED in this case) won't have sufficient voltage across it to keep operating. An LED makes this easy, since both BJTs and MOSFETs, used as switches, are easily able to essentially shut off the LED by bypassing it.
Note also that the sense of ON/OFF, relative to the MCU I/O control line is opposite to Pattern 2.
(The high-side switching pattern also applies for the parallel case here. But it also has the same limitations mentioned earlier.)
There is another pattern called a current source. (Actually, there are dozens of patterns used as current sources.) Since the current is more important when running an LED, a current source makes sense.
This only works in cases where you are operating this as a low-side switch pattern and where you have access to a voltage rail that is enough higher than \$V_\text{CC}\$ for the MCU. (Several volts higher, at least.) In this case, you can attempt the following:

simulate this circuit
Here, the \$+V\$ rail must be at least the LED voltage above \$V_\text{CC}\$. But in this case, the value of the resistor is computed as:
$$R_\text{SET}=\frac{V_\text{CC}-700\:\text{mV}}{I_\text{LED}}$$
There are a great many additional patterns that can be built upon these. (For example, Pattern 4 can be used in a high-side switch form if there is access to a sufficiently negative voltage rail.) And the above patterns have problems in special circumstances, such as when used at high frequencies or large currents. Each one has a limited range where it may apply. But I thought I'd provide some basic ideas here that you may be able to relate to what you've seen before.