/* USER CODE END WHILE */
if(keydown_flag == 1)
{
HAL_Delay(20);
if(pwm_value == 0)
{
up_down_flag = 0;
}
if(pwm_value == 50)
{
up_down_flag = 1;
}
if(up_down_flag == 0)
{
pwm_value++;
}
else
{
pwm_value--;
}
__HAL_TIM_SET_COMPARE(&htim4,TIM_CHANNEL_3,pwm_value);
}
else
{
__HAL_TIM_SET_COMPARE(&htim4,TIM_CHANNEL_3,0);
} |