Hi, I am currently trying to use PWM on nrf9160 DK to control a stepper motor. Do you have any sample code for PWM? Also do you have the pin assignment of which pin on the DK to use for PWM? Thanks.
Hi, I am currently trying to use PWM on nrf9160 DK to control a stepper motor. Do you have any sample code for PWM? Also do you have the pin assignment of which pin on the DK to use for PWM? Thanks.
Hi Daniel,
If using nRF Connect for VS Code you can click "New Application" and then 'Browse' next to the Application Template. This will for example let you search for 'PWM' and you will see relevant samples, both Zephyr and nRF. The documentation is then also easily available so that you would get an idea which one is relevant for your project.

For example, check out the 'led_pwm' sample. The list above shows a 'servo_motor' sample that I have not yet had a closer look at.
There is also an unofficial NRFX PWM Simple Example that shows "how to use the nrfx_pwm driver to access the NRF_PWM module in a more direct way compared to using the native Zephyr PWM driver". This example has been tested for nRF Connect SDK v1.8.0 and nRF52840.
I also found another DevZone case nRF52 PWM / Stepper Motor that looks relevant.