This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

multiple channels using same PWM instance

How can i initialise all four channel of pwm1 using pwm library. i need to initialise one channel for one purpose and other channel for different purpose. whenever i am trying to initialise it is showing error what shou;d be the correct way

what are the necessory changes in PWM library example

Parents Reply
  • Then set the duty cycle to 0 for the channel you dont want to use, and set the duty cycle to e.g. 50% on the channel you want to use. And then you can just switch this by using the app_pwm_channel_duty_set() function.

    while (app_pwm_channel_duty_set(&PWM1, 0, 50) == NRF_ERROR_BUSY); // 50% on channel 0
    
    while (app_pwm_channel_duty_set(&PWM1, 1, 0) == NRF_ERROR_BUSY); // 0% on channel 1
    
Children
No Data
Related