<?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 use BLE UART interrupt to jump out of a loop</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15593/how-to-use-ble-uart-interrupt-to-jump-out-of-a-loop</link><description>I am trying to figure out how to exit a loop of my program using a button press on the nRF Toolbox UART app. Say it&amp;#39;s button 4 for sake of giving it a value. I am using an Adafruit Feather 32u4 BLE microcontroller. I can start the motor from the app by</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 09 Aug 2016 08:41:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15593/how-to-use-ble-uart-interrupt-to-jump-out-of-a-loop" /><item><title>RE: How to use BLE UART interrupt to jump out of a loop</title><link>https://devzone.nordicsemi.com/thread/59492?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2016 08:41:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43d5db64-6915-4ce4-a5de-fbd8f936df1e</guid><dc:creator>&amp;#216;yvind Karlsen</dc:creator><description>&lt;p&gt;It&amp;#39;s a standard C function, did you #include &amp;lt;string.h&amp;gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use BLE UART interrupt to jump out of a loop</title><link>https://devzone.nordicsemi.com/thread/59491?ContentTypeID=1</link><pubDate>Mon, 08 Aug 2016 14:56:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0611b0e-8d20-40f4-a585-4db6cb0fa647</guid><dc:creator>cgaufin</dc:creator><description>&lt;p&gt;I am not able to compile using that function. I get a &amp;quot;variable or field &amp;#39;nus_data_handler&amp;#39; declared void&amp;quot; error. I must be missing a library or something.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use BLE UART interrupt to jump out of a loop</title><link>https://devzone.nordicsemi.com/thread/59490?ContentTypeID=1</link><pubDate>Fri, 05 Aug 2016 20:54:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de01bb90-3dc3-4825-ac1a-90f379360c13</guid><dc:creator>RichieJH</dc:creator><description>&lt;p&gt;BLE UART is effectively the interrupt.  It reacts when it gets an inbound message.  Do a &lt;code&gt;strncmp&lt;/code&gt; and then act accordingly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use BLE UART interrupt to jump out of a loop</title><link>https://devzone.nordicsemi.com/thread/59489?ContentTypeID=1</link><pubDate>Fri, 05 Aug 2016 20:34:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bcb2943e-a42d-4147-afc7-3ada462291d0</guid><dc:creator>cgaufin</dc:creator><description>&lt;p&gt;So one doesn&amp;#39;t need an interrupt then? The static void nus_data_handler(ble_nus_t * p_nus, uint8_t * p_data, uint16_t length) is constantly running in the background? I can then run a string comparison of &amp;quot;p_data&amp;quot; to &amp;quot;data&amp;quot; (the information sent from the nRF UART app) and if they equal 4 (the value sent by the button), then I can just go to a different loop or portion of the program? Interesting. I will let you know how that works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use BLE UART interrupt to jump out of a loop</title><link>https://devzone.nordicsemi.com/thread/59488?ContentTypeID=1</link><pubDate>Fri, 05 Aug 2016 20:25:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22ad598f-4ada-4db2-9a38-78b5bd32c73b</guid><dc:creator>RichieJH</dc:creator><description>&lt;p&gt;Received data through BLE UART ends up here&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void nus_data_handler(ble_nus_t * p_nus, uint8_t * p_data, uint16_t length)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So in that function add a little test that compares &lt;code&gt;p_data&lt;/code&gt; to some key and then call your stop function/set your stop flag when &lt;code&gt;p_data&lt;/code&gt; represents the right instruction.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>