added function to set the duty cycle by percentage, tested