@IkeHayes
Why not try using hardware PWM, which should have little or no overhead except when altering the frequency or duty cycle.
see the full post here....