Combining led blink and fade (PWM)

Does the code do what you want ?

The advantage of using static is that the previous value persists the next time that the variable is declared in the same scope but it can also be a disadvantage. It is OK when a function or state is entered and the previous value is needed but can be awkward if you need to reset the variable to its initial value in which case a global variable is much more convenient to use.

You should note that in your program you have 4 different static variables named pwmLevel each with their own scope and each of which can have different values at the same time and it prevents that value being used in other scopes. This may be what you intend but at the very least it makes the program harder to follow and may not be what you intend. If the values of the 4 variables is only needed in their own scope then it would be better to give them individual names to avoid confusion.