Replaced software PWM with hardware PWM (untested).