<?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>comment or uncomment a code in while loop cause problem?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/103348/comment-or-uncomment-a-code-in-while-loop-cause-problem</link><description>hi i use pca10056 board with segger embedded studio 
 i currently facing a bizzarre problem with my project 
 i use adc function and nus service and low frequency clock 
 everything went fine with my project until i tried to comment code 
 
 literally</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 15 Jan 2026 08:45:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/103348/comment-or-uncomment-a-code-in-while-loop-cause-problem" /><item><title>RE: comment or uncomment a code in while loop cause problem?</title><link>https://devzone.nordicsemi.com/thread/558761?ContentTypeID=1</link><pubDate>Thu, 15 Jan 2026 08:45:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51617172-c1fc-47d1-99bc-22542b41446f</guid><dc:creator>Seraphina</dc:creator><description>&lt;p&gt;&lt;a href="https://smashkarts76.com/"&gt;&lt;span style="font-weight:400;"&gt;Smash Karts 76&lt;/span&gt;&lt;/a&gt; challenges players to outdrive and outsmart opponents using rockets, mines, and power-ups in chaotic kart battles.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: comment or uncomment a code in while loop cause problem?</title><link>https://devzone.nordicsemi.com/thread/444407?ContentTypeID=1</link><pubDate>Tue, 05 Sep 2023 05:11:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ee7d2ce-01a0-4218-94fa-e5751b9e0206</guid><dc:creator>LeeJW</dc:creator><description>&lt;p&gt;my apologize for not clearing my question.&lt;/p&gt;
&lt;p&gt;i am in learning step with this stuff and&amp;nbsp; I had never faced this kind of issue&lt;/p&gt;
&lt;p&gt;so i was unable to give enough information&lt;/p&gt;
&lt;p&gt;i used the dk project with nrfToolBox and uart service.&lt;/p&gt;
&lt;p&gt;and i got a screeenshot of them&lt;/p&gt;
&lt;p&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/KakaoTalk_5F00_20230904_5F00_221010072_5F00_02.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;i sent g from phone and as shown above,&lt;/p&gt;
&lt;p&gt;i could receive data from board&lt;/p&gt;
&lt;p&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/5706.KakaoTalk_5F00_20230904_5F00_221010072_5F00_01.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;this is what i got after i commented that if code in while loop.&lt;/p&gt;
&lt;p&gt;i coded so that it sends adcflag value when g or s is received.&lt;/p&gt;
&lt;p&gt;which is in line 144&amp;nbsp;uint8_t adcflag&lt;/p&gt;
&lt;p&gt;and as you suggested,&lt;/p&gt;
&lt;p&gt;i initialized adc before while loop.&lt;/p&gt;
&lt;p&gt;and yeah whether that if code is commented or not,&lt;/p&gt;
&lt;p&gt;it worked well. so think putting initial function in while loop&lt;/p&gt;
&lt;p&gt;got messed up in someway.&lt;/p&gt;
&lt;p&gt;thanks for your reply&lt;/p&gt;
&lt;p&gt;best regards&lt;/p&gt;
&lt;p&gt;Lee&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: comment or uncomment a code in while loop cause problem?</title><link>https://devzone.nordicsemi.com/thread/444243?ContentTypeID=1</link><pubDate>Mon, 04 Sep 2023 08:20:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d30fb57-fec6-4c5f-816a-2c7548d1b103</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I am a bit confused to be honest, and I am not able to get it to work even with your dongle project (though I am able to connect and NUS is working (so writing a line with &amp;quot;s&amp;quot; in one I see &amp;quot;s&amp;quot; in the other).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How is&amp;nbsp;adcflag related to this issue?&amp;nbsp;Is it so that the issue is not just your line 1177-1180 after all, and that something else is needed?&lt;/p&gt;
&lt;p&gt;Are you able to share a project that works out of the box (with detailed instructions, the best if it is enough to just connect with a phone nRF Connect and enable say notifications on the NUS Tx characteristic and write the commands (like &amp;quot;g&amp;quot; or &amp;quot;s&amp;quot;) from the phone, to reduce the number of unknowns.&lt;/p&gt;
&lt;p&gt;Also, looking at your code it seems like it could use some cleanup (for instance, why is the initialization code inside the main loop and not before it, etc)? Without knowing what the root cause here is, it is typically much easier to spot issues of you clean-up and structure the code in a logical manner&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: comment or uncomment a code in while loop cause problem?</title><link>https://devzone.nordicsemi.com/thread/444135?ContentTypeID=1</link><pubDate>Fri, 01 Sep 2023 14:15:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b8c6d01-99dd-4063-bf14-b6c2e72ff0dd</guid><dc:creator>LeeJW</dc:creator><description>&lt;p&gt;Hi Einar&lt;/p&gt;
&lt;p&gt;i also used nrf52840 dongle as a central to communicate with PC sorry about not mention it&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/1106.usb_5F00_cdc_5F00_ble_5F00_fordongle_5F00_use_5F00_this.zip"&gt;devzone.nordicsemi.com/.../1106.usb_5F00_cdc_5F00_ble_5F00_fordongle_5F00_use_5F00_this.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;above is what i used for pca10059, same path&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Dk board sends packet to dongle by by ble nus service&lt;/p&gt;
&lt;p&gt;and dongle write packet string into serial terminal&lt;/p&gt;
&lt;p&gt;I made a test changing my variables&amp;nbsp;&lt;/p&gt;
&lt;p&gt;i use adcflag as global variable so that i can control ble by writing &amp;#39;g&amp;#39; or &amp;#39;s&amp;#39;&lt;/p&gt;
&lt;p&gt;to stop or enable saadc&lt;/p&gt;
&lt;p&gt;1. when i set adcflag value as 1 which means i wrote uint8_t adcflag=0;&lt;/p&gt;
&lt;p&gt;comment or uncomment that if code has nothing do with its function&lt;/p&gt;
&lt;p&gt;everything goes well dk sends adc value perfectly&lt;/p&gt;
&lt;p&gt;but i don&amp;#39;t want to enabling saadc and turnging on the board simultaneously&amp;nbsp;&lt;/p&gt;
&lt;p&gt;so setting adcflag=0 is what i want&lt;/p&gt;
&lt;p&gt;2. problem occurs when set adcflag as 0 from the beginnig&lt;/p&gt;
&lt;p&gt;i also tested by writing other word ( 3, 4)&amp;nbsp; to turn on LED on dk board&lt;/p&gt;
&lt;p&gt;and it turnd on led well. which means ble is not a issue.&lt;/p&gt;
&lt;p&gt;so when i comment that if code, i think timer or adc is facing error somehow&lt;/p&gt;
&lt;p&gt;i put&amp;nbsp;nrf_delay_us(500); in code but it didn&amp;#39;t work.&lt;/p&gt;
&lt;p&gt;i don&amp;#39;t know if it is priority or memory problem&amp;nbsp;&lt;/p&gt;
&lt;p&gt;i did debug but&amp;nbsp;no meaningful log was appeared&lt;/p&gt;
&lt;p&gt;thank you&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: comment or uncomment a code in while loop cause problem?</title><link>https://devzone.nordicsemi.com/thread/444078?ContentTypeID=1</link><pubDate>Fri, 01 Sep 2023 11:54:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:147b0f34-ad5a-499a-99f5-40012772cf97</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I did a quick test of your app with nRF5 SDK 17.1.0 but I am not getting any data in the UART terminal after typing g. I did not test more than that though, so If you would like me to test on my end please provide detailed instructions on how to reproduce and ensure it works with the exact project you uploaded.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;That said, the only thing this code does is to read an input pin, and that takes a (very short) amount of time. I am not able to see why that matters here so I would investigate more, but perhaps you could try to replace it with a very short delay first (nrf_delay_us()) to see if it has the same effect?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: comment or uncomment a code in while loop cause problem?</title><link>https://devzone.nordicsemi.com/thread/443960?ContentTypeID=1</link><pubDate>Thu, 31 Aug 2023 16:54:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f77c4d71-d9f2-4896-8ae5-00be9e5b3fd8</guid><dc:creator>LeeJW</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/ble_5F00_uart_5F00_adc_5F00_dk_5F00_use_5F00_this-250hz-_2800_2_2900_.zip"&gt;devzone.nordicsemi.com/.../ble_5F00_uart_5F00_adc_5F00_dk_5F00_use_5F00_this-250hz-_2800_2_2900_.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;i also attached my emproject file&lt;/p&gt;
&lt;p&gt;path is&amp;nbsp;C:\ncs\nRF5_SDK\examples\Workspace\&lt;/p&gt;
&lt;p&gt;if i wirte &amp;#39;g&amp;#39; in teraterm, i am supposed to get adc values from board and read it from teraterm&lt;/p&gt;
&lt;p&gt;but after i comment that if code, nothing pop up on my screen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>