<?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>NRF52832 turn on specific led with specific button press on any of 3 slave boards and action on master board</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/40616/nrf52832-turn-on-specific-led-with-specific-button-press-on-any-of-3-slave-boards-and-action-on-master-board</link><description>I have developing one project in that i am using nRF52832 and SD 15.0. Here is the current application developing: 
 
 There are 3 ble app_blinky(ble peripheral) example operated on battery and it connected to multilink central. 
 Lets say ble peripheral</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 20 Dec 2018 15:33:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/40616/nrf52832-turn-on-specific-led-with-specific-button-press-on-any-of-3-slave-boards-and-action-on-master-board" /><item><title>RE: NRF52832 turn on specific led with specific button press on any of 3 slave boards and action on master board</title><link>https://devzone.nordicsemi.com/thread/162707?ContentTypeID=1</link><pubDate>Thu, 20 Dec 2018 15:33:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26018a20-5f98-4b59-a0d9-c755cd1eb3e7</guid><dc:creator>Muhammad</dc:creator><description>&lt;p&gt;Dear Edvin,Thank you so much! It worked for me...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52832 turn on specific led with specific button press on any of 3 slave boards and action on master board</title><link>https://devzone.nordicsemi.com/thread/159923?ContentTypeID=1</link><pubDate>Mon, 03 Dec 2018 10:14:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca0a5862-eee2-4dbe-b1e7-21e2e35f0d98</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;you must study the function that is called when you press a button on the ble_app_blinky example. This functino is called button_event_handler.&lt;/p&gt;
&lt;p&gt;The function that actually sends the information over BLE is ble_lbs_on_button_change(m_conn_handle, &amp;amp;m_lbs, button_action);&lt;/p&gt;
&lt;p&gt;Where m_conn_handle is just the connection handle to the central. m_lbs is the service that you are updating, and button_action is the actual data that you are sending. This is the one you want to modify if you want to add more buttons.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So. In button_event_handler, the reason you get the event LEDBUTTON_BUTTON when you press the button is that this button is set up in buttons_init():&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    static app_button_cfg_t buttons[] =
    {
        {LEDBUTTON_BUTTON, false, BUTTON_PULL, button_event_handler}
    };&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If you want to add more buttons, just add lines with the buttons:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    static app_button_cfg_t buttons[] =
    {
        {LEDBUTTON_BUTTON, false, BUTTON_PULL, button_event_handler},
        {LEDBUTTON_BUTTON2, false, BUTTON_PULL, button_event_handler}
    };&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and add this case&amp;nbsp;&lt;/p&gt;
&lt;p&gt;LEDBUTTON_BUTTON2&lt;/p&gt;
&lt;p&gt;in button_event handler. Note that LEDBUTTON_BUTTON is defined as&amp;nbsp;BSP_BUTTON_0 -&amp;gt;&amp;nbsp;BUTTON_1 (in pca10040.h) -&amp;gt; 13&lt;/p&gt;
&lt;p&gt;If you define LEDBUTTON_BUTTON2 as BSP_BUTTON_1, it will be the second button.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Suggestion for button_event_handler:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void button_event_handler(uint8_t pin_no, uint8_t button_action)
{
    ret_code_t err_code;
    uint8_t button_state;

    switch (pin_no)
    {
        case LEDBUTTON_BUTTON:
        case LEDBUTTON_BUTTON2:
        
        if(button_action)       //meaning a button is pressed
        {
            button_state |= 1 &amp;lt;&amp;lt; (pin_no - LEDBUTTON_BUTTON);
        }
        else                    //meaning a button is released
        {
            button_state &amp;amp;= ~(1 &amp;lt;&amp;lt; pin_no - LEDBUTTON_BUTTON);
        }
        
            NRF_LOG_INFO(&amp;quot;Send button state change.&amp;quot;);
            err_code = ble_lbs_on_button_change(m_conn_handle, &amp;amp;m_lbs, button_state);
            if (err_code != NRF_SUCCESS &amp;amp;&amp;amp;
                err_code != BLE_ERROR_INVALID_CONN_HANDLE &amp;amp;&amp;amp;
                err_code != NRF_ERROR_INVALID_STATE &amp;amp;&amp;amp;
                err_code != BLE_ERROR_GATTS_SYS_ATTR_MISSING)
            {
                APP_ERROR_CHECK(err_code);
            }
            break;

        default:
            APP_ERROR_HANDLER(pin_no);
            break;
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If there are a lot of new terms for you, such as peripheral and central I suggest you read up on BLE first.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Then, in the ble_app_multilink_central example, you must check the lbs_c_evt_handler(). You will now see that the button states in the BLE_LBS_C_EVT_BUTTON_NOTIFICATION event, you will now see that the p_lbs_c_evt-&amp;gt;params.button.button_state equals either 0, 1, 2 or 3, depending on the button states on the connected devices. You can also see that the conn_handle depends on which connected board you press the buttons on.&lt;/p&gt;
&lt;p&gt;So if you want to do something when all connected devices press both buttons, you must ensure that you have button_state = 3 on all connected devices (all conn_handles).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You can experiment by watching the log on the central:&lt;/p&gt;
&lt;p&gt;NRF_LOG_INFO(&amp;quot;Link 0x%x, button state changed on peer to 0x%x, p_lbs_c_evt-&amp;gt;conn_handle, p_lbs_c_evt-&amp;gt;params.button.button_state);&lt;/p&gt;
&lt;p&gt;This will tell you the conn_handle, and the button_state whenever it changes on one of the connected devices.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52832 turn on specific led with specific button press on any of 3 slave boards and action on master board</title><link>https://devzone.nordicsemi.com/thread/159744?ContentTypeID=1</link><pubDate>Fri, 30 Nov 2018 14:59:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a33ec908-b00c-4688-aa3c-1e0ea05d84cb</guid><dc:creator>Muhammad</dc:creator><description>&lt;p&gt;Sorry I couldn&amp;#39;t come earlier..&lt;/p&gt;
&lt;p&gt;Dear Edvin,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I got what you described,but can you please tell more in detail about this handling.How will I be able to get that button value and how I assign that in the central connection.I am totally new,I need to know little more.I hope,you will make me clear.&lt;/p&gt;
&lt;p&gt;I got to this&amp;nbsp;&lt;strong&gt;&lt;span&gt;lbs_c_evt_handler() -&amp;gt; case&amp;nbsp;BLE_LBS_C_EVT_BUTTON_NOTIFICATION:&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span&gt;But&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;span&gt;what more to do with it,suppose I got some value (That i even don&amp;#39;t know where &amp;nbsp;to get,if i add extra button),but suppose I got this,then what shoud I do with it in this event handler.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;With regards&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52832 turn on specific led with specific button press on any of 3 slave boards and action on master board</title><link>https://devzone.nordicsemi.com/thread/158597?ContentTypeID=1</link><pubDate>Thu, 22 Nov 2018 10:35:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c40a0dfb-3ab9-4fb5-921a-60395c5a75c4</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;in ble_app_blinky, look for the button_event_handler, and what it sends. In the unmodified example, it will only send either 0x00 or 0x01 depending on whether the button is pressed or not. If you want to include more buttons, you must also include the pin number in this data. You only have 1 byte (uint8_t), so maybe you can send a button matrix:&lt;/p&gt;
&lt;p&gt;button 1 pressed: 0x01 = 0b00000001&lt;/p&gt;
&lt;p&gt;button 2 pressed: 0x02 = 0b00000010&lt;/p&gt;
&lt;p&gt;button1 and 2 pressed: 0x03 = 0b00000011&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;On the central, ble_app_multilink_central you must interpret this data on the&amp;nbsp;lbs_c_evt_handler() -&amp;gt; case&amp;nbsp;BLE_LBS_C_EVT_BUTTON_NOTIFICATION:&lt;/p&gt;
&lt;p&gt;button_state is the byte that you send from the peripheral (ble_app_blinky). Toggle the led according to this byte. To see which peripheral that sent the message, look at the conn_handle (connection handle), as I described in the previous reply. Each connected peripheral will have their own conn_handle, which you can find in the event: p_lbs_c_evt-&amp;gt;conn_handle;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52832 turn on specific led with specific button press on any of 3 slave boards and action on master board</title><link>https://devzone.nordicsemi.com/thread/158411?ContentTypeID=1</link><pubDate>Wed, 21 Nov 2018 13:00:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8272b590-d361-4a1e-b855-0590ed9b8a7f</guid><dc:creator>Muhammad</dc:creator><description>&lt;p&gt;Dear Edvin! Thank you..&lt;/p&gt;
&lt;p&gt;I actually have 3 slave boards and 1 master board.Master board has 4 leds &amp;nbsp;and 4 buttons .Whereas each slave board has 2 leds and 2 buttons.What I want is pressing button1 from slave 1 makes led1 to glow on master board,likewise,button2 on slave2 will glow led2 on master board and so on.And on master board side if i press button1, led1 of slave board will glow and so on.&lt;/p&gt;
&lt;p&gt;Problem:&lt;/p&gt;
&lt;p&gt;The issue that I&amp;#39;m facing is I am not getting the point,how to recognize each slave on master side &amp;nbsp;and also even i button2 on slave board to glow another led,how to dintinguish between pressed buttons on master boards.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Muhammad&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52832 turn on specific led with specific button press on any of 3 slave boards and action on master board</title><link>https://devzone.nordicsemi.com/thread/158217?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 14:43:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:684665ae-f47d-4e43-aede-aea0f41bcb23</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;1. You must check the connection handles of the events, as you say. This is done in the example that you refer to, SDK15.0.0, ble_app_multilink_central, lbs_c_evt_handler() case BLE_LBS_C_EVT_BUTTON_NOTIFICATION.&lt;/p&gt;
&lt;p&gt;It will print:&lt;/p&gt;
&lt;p&gt;&amp;quot;Link &amp;lt;connection_handle&amp;gt;, Button state changed on peer to &amp;lt;1/0&amp;gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;2: I don&amp;#39;t understand what you are trying to explain here.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Once all switches (Total 6) press at same time then it will wake up all 3&amp;nbsp;peripherals A, B and C connect to central device.[/quote]
&lt;p&gt;&amp;nbsp;Where are the switches located? On the central? 1 or 2 on each peripheral? If it is the peripherals, are they connected to the central at this point in time?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Want to ON all 6 LEDs in central at same time frame.[/quote]
&lt;p&gt;&amp;nbsp;Where are the LEDs located?&amp;nbsp;&lt;span&gt;&amp;nbsp;On the central? 1 or 2 on each peripheral? If it is the peripherals, are they connected to the central at this point in time?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]How i can do it.[/quote]
&lt;p&gt;&amp;nbsp;Depends on the questions above.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>