<?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 to handle LED blinking when advertising and LED flash when button is pressed;</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/8017/how-to-handle-led-blinking-when-advertising-and-led-flash-when-button-is-pressed</link><description>Hi, 
 I am a newbie to nrf, I am trying to understand the lbs example while running on nrf dev board. I want to set my application as follows: 
 
 Blinking LED while advertising 
 sending data packet when button pressed with LED indication (flash</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 08 Jul 2015 12:54:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/8017/how-to-handle-led-blinking-when-advertising-and-led-flash-when-button-is-pressed" /><item><title>RE: How to handle LED blinking when advertising and LED flash when button is pressed;</title><link>https://devzone.nordicsemi.com/thread/28726?ContentTypeID=1</link><pubDate>Wed, 08 Jul 2015 12:54:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4c08ac1-aae9-4b36-9156-29b00d2c1ece</guid><dc:creator>&amp;#216;yvind Karlsen</dc:creator><description>&lt;p&gt;Ok, I misunderstood, I thought you wanted to have the LEDs blinking each time the radio was active. To get a LED to blink while advertising you can use BSP_INDICATE_ADVERTISING like this&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Since you want your application to stop indicating that it is advertising when you are connected you need to do something like this upon entering connected state.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;err_code = bsp_indication_set(BSP_INDICATE_IDLE);
APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Make sure that you have all the dependencies met for BSP(See &lt;a href="https://developer.nordicsemi.com/nRF51_SDK/nRF51_SDK_v8.x.x/doc/8.0.0/s110/html/a00813.html#ga2a2c704a4832fa5ed49a66ea2f1faec8"&gt;the SDK&lt;/a&gt;), this may include adding BSP.c to your project. Also be aware that other things that change the LEDs can conflict with the BSP, so there&amp;#39;s a lot to take into consideration&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to handle LED blinking when advertising and LED flash when button is pressed;</title><link>https://devzone.nordicsemi.com/thread/28725?ContentTypeID=1</link><pubDate>Wed, 08 Jul 2015 10:39:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7706b667-734a-42c9-8510-9b2eac7d2969</guid><dc:creator>HSA</dc:creator><description>&lt;p&gt;Dear Øyvind, Thanks.
I checked the radio_notification example, Its quiet well explained for advertising in case of beacon. I tried to use it in my lbs application but in-case when I get connected state (nRF&amp;lt;-----&amp;gt; phone), led blinking is not off. I wish to get ,,,in connected state, led blinking should be off and once disconnected, again start blinking, indicating advertisement. How can I implement this.&lt;/p&gt;
&lt;p&gt;Also should I use BSP_INDICATE_ADVERTISING or RADIO_NOTIFICATION. Please clear. Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to handle LED blinking when advertising and LED flash when button is pressed;</title><link>https://devzone.nordicsemi.com/thread/28723?ContentTypeID=1</link><pubDate>Tue, 07 Jul 2015 06:21:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b02c332-b90c-4af5-9904-2fda3572ec60</guid><dc:creator>&amp;#216;yvind Karlsen</dc:creator><description>&lt;p&gt;Ok, I might be misunderstanding your question. You can get a lit LED while advertising by using radio notification, how to do this is fully described in &lt;a href="https://devzone.nordicsemi.com/tutorials/14/radio-notification/"&gt;this tutorial&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to handle LED blinking when advertising and LED flash when button is pressed;</title><link>https://devzone.nordicsemi.com/thread/28724?ContentTypeID=1</link><pubDate>Tue, 07 Jul 2015 01:58:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fdfb1b36-810e-4bf6-b169-e5c4be7c16ab</guid><dc:creator>HSA</dc:creator><description>&lt;p&gt;Dear Øyvind,
Thanks for your prompt reply~&lt;/p&gt;
&lt;p&gt;well, I went throught the BSP example, you suggested, I understood some of its main functions like sending data packets..... But as I am following LBS example, I want to add led blinking while advertising. The leds_init is already defined for advertising/connected/ledbutton.&lt;br /&gt;
Please suggest, Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to handle LED blinking when advertising and LED flash when button is pressed;</title><link>https://devzone.nordicsemi.com/thread/28722?ContentTypeID=1</link><pubDate>Mon, 06 Jul 2015 06:20:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8774ab1b-484e-4ad1-a9e3-676b95d0d065</guid><dc:creator>&amp;#216;yvind Karlsen</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Have a look at the tutorial on the &lt;a href="https://devzone.nordicsemi.com/tutorials/13/board-support-packagebsp/"&gt;Board Support Package&lt;/a&gt;. Once you have that running you can make an event handler that does something like this pseudocode:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;switch(evt)
    case button_pressed:
        send_packet;
    default:
        do_nothing;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>