<?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>How do I control an external LED using nRf52832 ble board?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21175/how-do-i-control-an-external-led-using-nrf52832-ble-board</link><description>Hey, 
 I am trying to control an external LED using two nRF52832 boards. I am using &amp;quot;nRF5_SDK_13.0.0_04a0bfd\examples\ble_peripheral\experimental_ble_app_blinky&amp;quot; code for enabling &amp;amp; disabling LED 3 on the peripheral board. I have connected an external</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 06 Apr 2017 13:07:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21175/how-do-i-control-an-external-led-using-nrf52832-ble-board" /><item><title>RE: How do I control an external LED using nRf52832 ble board?</title><link>https://devzone.nordicsemi.com/thread/82869?ContentTypeID=1</link><pubDate>Thu, 06 Apr 2017 13:07:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60c4154d-f644-433a-9f38-e0a331c9e472</guid><dc:creator>Chakradhar</dc:creator><description>&lt;p&gt;Thank you, I will give this a try.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I control an external LED using nRf52832 ble board?</title><link>https://devzone.nordicsemi.com/thread/82868?ContentTypeID=1</link><pubDate>Thu, 06 Apr 2017 11:44:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2fa4d8f8-b7e9-40f2-8b8c-0a8f79431575</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This can be solved in several ways. One solution can be to set-up a app-timer, with a timeout-handler that reads the LED-pin, and then writes the status to pin 11 at fixed intervals. When you mentioned LED-3, is this the LED3 on the DK ? If so, that LED is connected to P0.19 on the DK. Also note that you don&amp;#39;t need to initialize or configure the LEDs on the DK yourself, this is done in the function called &lt;code&gt;leds_init()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Here is one solution:&lt;/p&gt;
&lt;p&gt;Let’s define the timer and timeout interval we want:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;APP_TIMER_DEF(m_my_led_timer_id);                        /**&amp;lt; My LED timer. */
#define MY_LED_TIMER_INTERVAL      APP_TIMER_TICKS(100)  /**&amp;lt; MY_LED_TIMER_INTERVAL interval (ticks). */
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The timout handler can look something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void my_led_timeout_handler(void * p_context)
{
    UNUSED_PARAMETER(p_context);
    if(nrf_gpio_pin_out_read(19) == 0)
    {
        nrf_gpio_pin_write(11,1);
    }
    else
    {
        nrf_gpio_pin_write(11,0);
    }
    
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In main(),&lt;/p&gt;
&lt;p&gt;Lets first config pin 11 to be a output:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_gpio_cfg_output(11);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and we can then create and start the timer like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t err_code;

err_code = app_timer_create(&amp;amp;m_my_led_timer_id,
                            APP_TIMER_MODE_REPEATED,
                            my_led_timeout_handler);
APP_ERROR_CHECK(err_code);

 // Start application timers.
err_code = app_timer_start(m_my_led_timer_id, MY_LED_TIMER_INTERVAL, NULL);
APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>