Hi,
I use SDK 10 pwm example (examples\peripheral\pwm) to modify the PWM cycle to 10s and duty cycle to 50%.
Code showed as below:
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
int main(void)
{
ret_code_t err_code;
/* 2-channel PWM, 200Hz, output on DK LED pins. */
app_pwm_config_t pwm1_cfg = APP_PWM_DEFAULT_CONFIG_2CH(10000000L, BSP_LED_0, BSP_LED_1);
/* Switch the polarity of the second channel. */
pwm1_cfg.pin_polarity[1] = APP_PWM_POLARITY_ACTIVE_HIGH;
/* Initialize and enable PWM. */
err_code = app_pwm_init(&PWM1,&pwm1_cfg,pwm_ready_callback);
APP_ERROR_CHECK(err_code);
app_pwm_enable(&PWM1);
//uint32_t value;
while(true)
{
for (uint8_t i = 0; i < 40; ++i)
{
But the PWM cycle seem only around 3 seconds. Can it possible change PWM cycle time to 10s ? If can, how to do so?
Thanks.