<?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>Switching LED state using button in Blinky example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50261/switching-led-state-using-button-in-blinky-example</link><description>Hello, 
 I am playing around with the Blinky example on my custom board, where I have one button and two leds. Everything works fine and I can control the LED2 and detect the button action using the smartphone. 
 What I would like to do now, is to change</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 29 Jul 2019 14:49:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50261/switching-led-state-using-button-in-blinky-example" /><item><title>RE: Switching LED state using button in Blinky example</title><link>https://devzone.nordicsemi.com/thread/201029?ContentTypeID=1</link><pubDate>Mon, 29 Jul 2019 14:49:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f49f70cb-5536-4a7e-ab71-fa0c3de593b7</guid><dc:creator>antoniov</dc:creator><description>&lt;p&gt;Done ;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Switching LED state using button in Blinky example</title><link>https://devzone.nordicsemi.com/thread/201028?ContentTypeID=1</link><pubDate>Mon, 29 Jul 2019 14:44:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4ea593e-9d26-4630-b7c1-52a112e498c7</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;No problem, I&amp;#39;m always happy to help. Would you like to verify the answer?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Switching LED state using button in Blinky example</title><link>https://devzone.nordicsemi.com/thread/201022?ContentTypeID=1</link><pubDate>Mon, 29 Jul 2019 14:28:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eab4fee5-8c37-4218-8766-d4a93497234d</guid><dc:creator>antoniov</dc:creator><description>&lt;p&gt;Thank you Simon!!&lt;/p&gt;
&lt;p&gt;I followed your points. It works perfectly &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Switching LED state using button in Blinky example</title><link>https://devzone.nordicsemi.com/thread/200848?ContentTypeID=1</link><pubDate>Sat, 27 Jul 2019 19:14:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a20c6e7d-5fb3-4032-bad9-b8b826b6e483</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;You need to do 4 things:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Enable notifications on the LED characteristic&amp;nbsp;
&lt;ul&gt;
&lt;li&gt;This is done for the button characteristic, take a look at the function&amp;nbsp;&lt;em&gt;ble_lbs_init()&lt;/em&gt;&amp;nbsp;in &lt;em&gt;ble_bls.c&amp;nbsp;&lt;/em&gt;to see how it is done&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Add a notify function for the LED characteristics
&lt;ul&gt;
&lt;li&gt;Take a look at the function&amp;nbsp;&lt;em&gt;ble_lbs_on_button_change()&amp;nbsp;&lt;/em&gt;in&amp;nbsp;&lt;em&gt;ble_lbs_init() &lt;/em&gt;to see how this is done. This function notifies the Button characteristic&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Add your button to the array&lt;em&gt; button[]&lt;/em&gt; in &lt;em&gt;buttons_init()&lt;/em&gt; in &lt;em&gt;main.c&lt;/em&gt;
&lt;ul&gt;
&lt;li&gt;E.g. YOUR_BUTTON&amp;nbsp;(Set the&amp;nbsp;define equal to whatever pin the button is connected to on your custom board)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Add a new event for a button click
&lt;ul&gt;
&lt;li&gt;Inside &lt;em&gt;button_event_handler()&lt;/em&gt; in &lt;em&gt;main.c&lt;/em&gt;, add a new case with e.g. YOUR_BUTTON which will call the function made in step 2&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I have not tested this myself and may have forgotten something, but I believe this should work.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>