<?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 get the value of a timer.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73078/how-to-get-the-value-of-a-timer</link><description>Hello everyone. I want to turn the LED on and off with the push button, if I want to hold it down after 3 seconds the LED will turn off, if it has been pressed for less than 3, the LED will blink. 
 I am using TIMER2, but after 3 seconds the LED still</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 22 Mar 2021 13:35:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73078/how-to-get-the-value-of-a-timer" /><item><title>RE: How to get the value of a timer.</title><link>https://devzone.nordicsemi.com/thread/301220?ContentTypeID=1</link><pubDate>Mon, 22 Mar 2021 13:35:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:213c80e5-ae64-49b3-b734-535c787d91b4</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]&lt;p&gt;I want to turn the LED on and off with the push button, if I want to hold it down after 3 seconds the LED will turn off, if it has been pressed for less than 3, the LED will blink.&lt;/p&gt;
&lt;p&gt;I am using TIMER2, but after 3 seconds the LED still does not turn off.&lt;/p&gt;[/quote]
&lt;p&gt;Have you seen &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/group__bsp.html"&gt;the BSP library&lt;/a&gt;? The BSP library implements button support, and has already implemented&amp;nbsp;&lt;em&gt;long_push&amp;nbsp;&lt;/em&gt;functionality.&lt;br /&gt;You can then assign a button push to an action using the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.0.2%2Fgroup__bsp.html&amp;amp;anchor=ga22d22458135f52c2148f8567fff79c6f"&gt;bsp_event_to_button_action_assign&lt;/a&gt;&amp;nbsp;to assign an action to a button action, and the button action could then be&amp;nbsp;&lt;a title="BSP_BUTTON_ACTION_LONG_PUSH" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/group__bsp.html?cp=7_1_6_10_8_6#gaa51f175faef6d6995ce080285eb3c1e1"&gt;BSP_BUTTON_ACTION_LONG_PUSH&lt;/a&gt;.&lt;br /&gt;It is especially easy to use if you are already developing from a BLE example, since it is most likely in use already.&lt;br /&gt;&lt;br /&gt;This way, you do not have to implement this functionality again on your own.&lt;br /&gt;&lt;br /&gt;Please let me know if this is not what you were looking for!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>