28BYJ-48 5-Volt Stepper

That makes sense to me. You can only go 7RPM when you change directions without a delay. You can go 14RPM in one direction. The solution is simple. Go 14RPM, then stop for a short delay before changing directions. It's easy to calculate the delay using 7RPM. It's just twice the delay between steps at 14RPM.

Why not use 12V as in my code? You can change the duty cycle while moving so it never gets warm. Increase it back to 100% for 1 step before and after you change directions. This will give you 30RPM without any delay, even when changing directions. That's 4x faster.