<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Pulse width modulation nRF52832</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22471/pulse-width-modulation-nrf52832</link><description>Hi all! I used PWM module of nRF52832 to create the PWM but i don&amp;#39;t know how to update new value to duty_cycle. This is my code. I used Button (Pin 13) to set a new DUTY_CYCLE. Help me, pls. 
 #include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;string</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 02 Jun 2017 05:58:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22471/pulse-width-modulation-nrf52832" /><item><title>RE: Pulse width modulation nRF52832</title><link>https://devzone.nordicsemi.com/thread/88339?ContentTypeID=1</link><pubDate>Fri, 02 Jun 2017 05:58:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e998ec7-fbe2-4d6f-a852-f505b5273ccc</guid><dc:creator>lovee90</dc:creator><description>&lt;p&gt;it works fine. Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Pulse width modulation nRF52832</title><link>https://devzone.nordicsemi.com/thread/88338?ContentTypeID=1</link><pubDate>Thu, 01 Jun 2017 11:46:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3456d35e-21d7-4418-bb94-5b2890929d39</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Just add this code below the line where you have &lt;code&gt;NRF_GPIO -&amp;gt; OUT = 0 &amp;lt;&amp;lt; 17&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint16_t pwm_seq[4] = {DUTY_CYCLE};
NRF_PWM0-&amp;gt;SEQ[0].PTR  = (uint32_t)pwm_seq;
NRF_PWM0-&amp;gt;TASKS_SEQSTART[0] = 1;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I would recommend using the PWM drivers that we have in the SDK. There is an example in &lt;code&gt;SDK_folder\examples\peripheral\pwm_driver\&lt;/code&gt;. If you want a simpler example you can find one in this &lt;a href="https://devzone.nordicsemi.com/question/137430/is-there-a-simple-example-how-to-set-a-pwm-driver/?answer=138420#post-id-138420"&gt;devzone post&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;If you are concerned with power consumption, I would recommend making the part of the code where you check button 1(pin 13) interrupt driven. Take a look at the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v13.0.0/pin_change_int_example.html?cp=4_0_0_4_4_15"&gt;pin_change_int&lt;/a&gt; example in the SDK.&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>