Frequency can now be changed for software and hardware pwm.
Added test code.