<?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 can I connect multiple buttons and LEDs to a BLE device from nrf5340dk?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/103846/how-can-i-connect-multiple-buttons-and-leds-to-a-ble-device-from-nrf5340dk</link><description>I have tested the example code &amp;quot;peripheral_lbs&amp;quot; and it only works with an LED and a button with the nRF5340 kit. 
 I have also tried to modify the source code without success. I have only been able to have success by turning on two LEDs simultaneously</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 28 Sep 2023 09:14:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/103846/how-can-i-connect-multiple-buttons-and-leds-to-a-ble-device-from-nrf5340dk" /><item><title>RE: How can I connect multiple buttons and LEDs to a BLE device from nrf5340dk?</title><link>https://devzone.nordicsemi.com/thread/448092?ContentTypeID=1</link><pubDate>Thu, 28 Sep 2023 09:14:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b94fdcf8-68c7-41e3-87fe-879f1be15128</guid><dc:creator>Menon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m happy to hear that. Let me know if you have any doubts, or you can create new tickets if you come across any issues during the development.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind Regards,&lt;/p&gt;
&lt;p&gt;Abhijith&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I connect multiple buttons and LEDs to a BLE device from nrf5340dk?</title><link>https://devzone.nordicsemi.com/thread/448054?ContentTypeID=1</link><pubDate>Thu, 28 Sep 2023 05:06:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:554735da-1f69-43ae-a71c-bb36955347cc</guid><dc:creator>gap_guillen</dc:creator><description>&lt;p&gt;Thanks for sharing this interesting tutorial. I will follow your advice, so I will repeat the experience of all the lessons and then I will comment my opinion. At first sight, I think this clarifies my big doubts for the moment.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Guillermo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I connect multiple buttons and LEDs to a BLE device from nrf5340dk?</title><link>https://devzone.nordicsemi.com/thread/447906?ContentTypeID=1</link><pubDate>Wed, 27 Sep 2023 09:48:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc65db6c-4c93-4ab6-8ce6-ed61c3e5f27d</guid><dc:creator>Menon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Peripheral_lbs is a good starting point or reference template for your use case, but I recommend you go through&lt;a href="https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-4-bluetooth-le-data-exchange/topic/blefund-lesson-4-exercise-1/"&gt; this tutorial,&lt;/a&gt; which explains more about the GATT API and custom services and characteristics. The sample is very similar to peripheral_lbs, but here it demonstrates how these services and characteristics are made. Please see how the characteristics work and how this controls the LED. I recommend you follow the whole lesson &lt;a href="https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-4-bluetooth-le-data-exchange/"&gt;(lesson 4)&lt;/a&gt; to get a better understanding of this. Let me know if this clears some of your doubts or if you are still struggling.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind Regards,&lt;/p&gt;
&lt;p&gt;Abhijith&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I connect multiple buttons and LEDs to a BLE device from nrf5340dk?</title><link>https://devzone.nordicsemi.com/thread/446973?ContentTypeID=1</link><pubDate>Thu, 21 Sep 2023 04:35:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce9c848b-ec6c-4db6-96b2-269510518884</guid><dc:creator>gap_guillen</dc:creator><description>&lt;p&gt;&lt;strong&gt;Hi&amp;nbsp;Abhijith,&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Thanks for your answer, I didn&amp;#39;t know the details of the DK buttons and LED library. I give you more details of what I want to do:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;1. My idea is to control two speeds and the turn&amp;nbsp;OFF of a fan via Bluetooth with the nRF5340DK or any Nordic board.&amp;nbsp;I also want to know if there is electrical power through buttons activated by relays or mosfets.&amp;nbsp;&lt;/span&gt;&lt;span&gt;The nRF Connect app connects with the lbs_peripheral project to monitor a button, and to turn ON/OFF an LED on the board.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2. I want to modify this demo to control 3 ports of the nRF5340DK board: Port 1 to turn OFF the fan, port 2 for low speed, and port 3 for high speed.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3. First, I have experimented with turning two LEDs on and off, but I have not had success. For example this code:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define USER_LED2                DK_LED4
static void app_led_cb(bool led_state)
{
dk_set_led(USER_LED, led_state);
dk_set_led(USER_LED2, led_state);
}

&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The app only detects one LED, and I want it to detect and control 2 LEDs.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Screenshot_5F00_20230920_5F00_212422_5F00_nRF-Connect.jpg" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Conclusion this only serves to turn on or off two LEDs simultaneously.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/20230920_5F00_212558.jpg" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;4.&amp;nbsp;Also&amp;nbsp;for monitoring two buttons. I have done this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define USER_BUTTON             DK_BTN1_MSK
#define BUTTON_2             	DK_BTN2_MSK 

static void button_changed(uint32_t button_state, uint32_t has_changed)
{
	if (has_changed &amp;amp; USER_BUTTON) {
		uint32_t user_button_state = button_state &amp;amp; USER_BUTTON;

		bt_lbs_send_button_state(user_button_state);
		app_button_state = user_button_state ? true : false;
	}

	if (has_changed &amp;amp; BUTTON_2) {
		uint32_t user_button_state_2 = button_state &amp;amp; BUTTON_2;

		bt_lbs_send_button_state(user_button_state_2);
		app_button_state_2 = user_button_state_2 ? true : false;
	}

}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span&gt;When I press button 1 or button 2, the app detects as if I pressed a single button. It doesn&amp;#39;t tell me which button I pressed.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Screenshot_5F00_20230920_5F00_212249_5F00_nRF-Connect.jpg" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I hope I have clarified what I want to do. Now, I want to know what I&amp;#39;m doing wrong? Is it possible or not possible to make my idea with the nRF5340DK board?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Regards,&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Guillermo&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I connect multiple buttons and LEDs to a BLE device from nrf5340dk?</title><link>https://devzone.nordicsemi.com/thread/446675?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2023 13:22:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a440320-1606-4a2a-8f61-8f2a70e4fe88</guid><dc:creator>Menon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;In&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/peripheral_lbs/README.html"&gt;peripheral_lbs sample&lt;/a&gt; LED button service is used to receive information about the state of an LED and send a notification to the mobile app when the button is pressed (when the state changes). For this service, the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/others/dk_buttons_and_leds.html#c.DK_BTN3"&gt;DK buttons and LEDs library&lt;/a&gt; has been used in the sample. You can actually change the LEDs or buttons in the development kit depending on your use case. Take a look at the function dk_set_led, which is used to set only a single LED value, which is used inside this sample.&lt;/p&gt;
&lt;p&gt;Could you explain the use case a bit more? Do you want to read two-button state changes and include two LEDs? For doing this, I don&amp;#39;t think you need to modify the mobile application to include the two buttons or two LEDs, as it is BLE service-based.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind Regards.&lt;/p&gt;
&lt;p&gt;Abhijith&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>