<?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>toggle a pin  of nrf52</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/31324/toggle-a-pin-of-nrf52</link><description>hi, 
 I am using nrf 52 DK and softdevice S132,PCA10040 board . I need to toggle a pin,set a pin,reset a pin .can anyone take this ticket to a sample code/ code snippet and which packs do i need to install.basically i just want to write a simple code</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 14 Mar 2018 14:42:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/31324/toggle-a-pin-of-nrf52" /><item><title>RE: toggle a pin  of nrf52</title><link>https://devzone.nordicsemi.com/thread/124408?ContentTypeID=1</link><pubDate>Wed, 14 Mar 2018 14:42:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14eecd07-169a-4bd3-8dc2-26730dae3147</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;&lt;a href="http://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v14.x.x/" target="_blank" rel="noopener noreferrer"&gt;download link to SDKv14.2&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toggle a pin  of nrf52</title><link>https://devzone.nordicsemi.com/thread/124324?ContentTypeID=1</link><pubDate>Wed, 14 Mar 2018 09:55:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:038458cb-001b-4302-a164-4dd5ddbb975f</guid><dc:creator>kirt</dc:creator><description>&lt;p&gt;hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;i gone through the step 1,2,6.where can i get&amp;nbsp;&lt;span&gt;nRF5_SDK_14.1.0_04a0bfd&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;and i am using nRF52Dk as a debugger/programmer.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toggle a pin  of nrf52</title><link>https://devzone.nordicsemi.com/thread/123962?ContentTypeID=1</link><pubDate>Mon, 12 Mar 2018 14:24:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53fdd423-cdeb-4881-b09b-fcd2152e8328</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;&lt;a href="https://github.com/bjornspockeli/nRF52_peripherals_tutorial" target="_blank" rel="noopener noreferrer"&gt;Look at Step 6 in this tutorial&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: toggle a pin  of nrf52</title><link>https://devzone.nordicsemi.com/thread/123784?ContentTypeID=1</link><pubDate>Sat, 10 Mar 2018 23:07:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f38bcea-669d-4ae0-943a-174150cd6e37</guid><dc:creator>rishi.sikka</dc:creator><description>&lt;p&gt;Hey Kirt, this shouldn&amp;#39;t be a problem at all. I do believe this is also a common question on the forum.&lt;/p&gt;
&lt;p&gt;Simply include nrf_gpio.h in your C/C++ source file. This is Nordic&amp;#39;s API that will let you interface with board at a high level. You can read more about GPIO&amp;nbsp;&lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fgpio.html"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I would define a pin at the top of your code like the following.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;nrf_gpio.h&amp;quot;

#define YOUR_PIN 			NRF_GPIO_PIN_MAP(1,3)	// Example connection - P1.03
#define FREQUENcY_MS        500

// in your init function use this to configure the pin: 
nrf_gpio_cfg_output(YOUR_PIN);  /* Initialize with default config of pin */


// probably you will put this in main loop ...

nrf_gpio_pin_toggle(YOUR_PIN);
nrf_delay_ms(FREQUENCY_MS);

// other useful gpio functions 
// nrf_gpio_pin_set(YOUR_PIN);
// nrf_gpio_pin_clear(YOUR_PIN);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The NRF_GPIO_PIN_MAP is a simple macro that converts the Pin # printed on the&amp;nbsp;DK to the appropriate map for the board. The cfg_output simply sets the pin as an output instead of an input (no need for internal pull resistors).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Then use the nrf_delay_ms function to create your frequency to continuously toggle a pin.&lt;/p&gt;
&lt;p&gt;Hopefully this helps,&lt;/p&gt;
&lt;p&gt;Rishi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>