diff --git a/source/test/pwm/main.c b/source/test/pwm/main.c index 9ad07bd..b9150fa 100644 --- a/source/test/pwm/main.c +++ b/source/test/pwm/main.c @@ -74,11 +74,16 @@ static void th_func(void *arg) unsigned int duty = 0; pwm_open(&pwm_ch4); while(1) { - pwm_set_duty_cycle(&pwm_ch4, duty); - sleep_ms(100); - duty++; - if(duty > 100) - duty = 0; + while(duty < 100) { + pwm_set_duty_cycle(&pwm_ch4, duty); + sleep_ms(10); + duty++; + } + while(duty > 0) { + pwm_set_duty_cycle(&pwm_ch4, duty); + sleep_ms(10); + duty--; + } } }