<?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>LED Handling UART</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/24512/led-handling-uart</link><description>Hello All, 
 I am designing one custom board where i want to Handle the LEDS, Like in Nrf51DK when we connect through UART_APP from smartphone blinking LED1 on DK gets constant.
Where in the program i can control the LED.? 
 thanks in advance and for</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 22 Aug 2017 06:56:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/24512/led-handling-uart" /><item><title>RE: LED Handling UART</title><link>https://devzone.nordicsemi.com/thread/96507?ContentTypeID=1</link><pubDate>Tue, 22 Aug 2017 06:56:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d17773c0-76ff-4475-b76b-575bfcbc6e5d</guid><dc:creator>Joakim Jakobsen</dc:creator><description>&lt;p&gt;If you can&amp;#39;t get the LED&amp;#39;s working as they should on your custom board, its probably because the pin configuration doesn&amp;#39;t match the pins and LED&amp;#39;s on your custom board. Take a look at my answer in &lt;a href="https://devzone.nordicsemi.com/question/137927/what-is-the-function-of-bsph-header/"&gt;this&lt;/a&gt; post for more information.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LED Handling UART</title><link>https://devzone.nordicsemi.com/thread/96506?ContentTypeID=1</link><pubDate>Tue, 22 Aug 2017 06:40:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:712eab9a-e48f-44dd-97e0-5bb0804275a3</guid><dc:creator>Joakim Jakobsen</dc:creator><description>&lt;p&gt;That should be exactly what the ble_app_uart example does. If you take a look at my answer above again, you will see that the parts of the code I added in my answer is the part of the code that does what you want. The &lt;code&gt;BLE_ADV_EVT_FAST&lt;/code&gt; make the LED blink, and the &lt;code&gt;BLE_GAP_EVT_CONNECTED&lt;/code&gt; makes the LED glow(stay on).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LED Handling UART</title><link>https://devzone.nordicsemi.com/thread/96508?ContentTypeID=1</link><pubDate>Mon, 21 Aug 2017 15:52:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6dd2cb3-292a-459b-8b6d-a178993fd757</guid><dc:creator>pavan</dc:creator><description>&lt;p&gt;Dear Sir,&lt;/p&gt;
&lt;p&gt;Thank you for your information.&lt;/p&gt;
&lt;p&gt;I am also using same SDK on my board , Actually my requirement is like  when i power on the board  LED should start blinking i.e which indicates the advertising mode. when i connect through the smartphone app lets say using UART_BLE app LED should in GLOW(on) state until i disconnect . do you have any code for such application?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LED Handling UART</title><link>https://devzone.nordicsemi.com/thread/96505?ContentTypeID=1</link><pubDate>Mon, 21 Aug 2017 14:18:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:436deb92-a020-4a41-bbb8-8867a0292928</guid><dc:creator>Joakim Jakobsen</dc:creator><description>&lt;p&gt;Hi Pavan!&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know what SDK you are working with. But I have based my answer on the ble_app_uart example in SDK v12.3.0
(Although it might not be any difference from earlier versions.)&lt;/p&gt;
&lt;p&gt;How the LED 1 is behaving is handled multiple places.
One example is the function in your code that handles the advertising events:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void on_adv_evt(ble_adv_evt_t ble_adv_evt)  
    uint32_t err_code;
    switch (ble_adv_evt)
    {
        case BLE_ADV_EVT_FAST:
            err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
            APP_ERROR_CHECK(err_code);
            break;
        case BLE_ADV_EVT_IDLE:
            sleep_mode_enter();
            break;
        default:
            break;
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There you can see that when the event &lt;code&gt;BLE_ADV_EVT_FAST&lt;/code&gt; is passed to your application,&lt;br /&gt;
&lt;code&gt;err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING)&lt;/code&gt; will make LED 1 indicate that the device is advertising.&lt;/p&gt;
&lt;p&gt;There is also a function in your code that handles the application&amp;#39;s SoftDevice events. Here is a small snipped:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void on_ble_evt(ble_evt_t * p_ble_evt)
    uint32_t err_code;
    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
            APP_ERROR_CHECK(err_code);
            m_conn_handle = p_ble_evt-&amp;gt;evt.gap_evt.conn_handle;
            break; // BLE_GAP_EVT_CONNECTED
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There you can see that LED 1 will indicate that the device is in a connected state when receiving the &lt;code&gt;BLE_GAP_EVT_CONNECTED&lt;/code&gt;
event.  You can change how the LEDs will behave in these event handlers. Else you can remove it from the event handlers,
and define how the LEDs should behave somewhere else in your code. You can read more about the predefined BSP indication
states &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.3.0/examples_bsp.html?cp=4_0_3_3_6_0_0#examples_bsp_states"&gt;here&lt;/a&gt;. You can also change the advertising LED in bsp_config.h:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define BSP_LED_INDICATE_INDICATE_ADVERTISING BSP_BOARD_LED_0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However, when making your own custom board, there would be a few things to keep in mind if you want to
use the Board Support Package (BSP). The easiest way to control the LEDs on a custom board would probably be to use the
nrf_gpio interface directly. You can read more about how to do this in this &lt;a href="https://devzone.nordicsemi.com/question/154761/unable-to-control-gpio-pins-in-nrf51422/?answer=154806#post-id-154806"&gt;answer&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This turned out to be a pretty general answer, as I don&amp;#39;t know exactly what you want to do. If you have any more specific
problems, you are welcome to ask in the comments below.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;
Joakim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LED Handling UART</title><link>https://devzone.nordicsemi.com/thread/96504?ContentTypeID=1</link><pubDate>Mon, 21 Aug 2017 09:42:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed27b03f-8635-42ae-b6d8-225444606adb</guid><dc:creator>pavan</dc:creator><description>&lt;p&gt;designing custom board with nrf51822 SOC.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>