<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Problem with button input during loop. (interupt loop)]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I have developed a productivity timer application and am encountering two issues related to interrupting a loop that includes a sleep operation.</p>
<p dir="auto">Interrupt Timing: Currently, to interrupt the loop using a button press, the button must be triggered at the precise moment the event occurs within the loop. This makes it very difficult to reliably interrupt the loop as intended.<br />
Label Update After Interruption: When the loop is successfully paused, a display label (label 0) still updates once more with a lower value before halting, which is unintended.<br />
Could you please advise how I might improve the code to:</p>
<p dir="auto">Allow the loop to be interrupted at any time, rather than requiring precise timing, and<br />
Prevent the label from updating after the interruption is triggered?<br />
Thank you in advance for your assistance.</p>
<p dir="auto">Here is a link to my projectL <a href="https://uiflow2.m5stack.com/?pkey=afd1587cf202443388b62587e6c3744e" target="_blank" rel="noopener noreferrer nofollow ugc">https://uiflow2.m5stack.com/?pkey=afd1587cf202443388b62587e6c3744e</a></p>
]]></description><link>https://community.m5stack.com/topic/7436/problem-with-button-input-during-loop-interupt-loop</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 06:02:07 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/7436.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 26 Mar 2025 02:19:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem with button input during loop. (interupt loop) on Fri, 25 Apr 2025 07:00:10 GMT]]></title><description><![CDATA[<p dir="auto">To interrupt a loop using a button input, ensure the program continuously checks the button state within the loop. If the loop doesn't monitor inputs regularly, it may miss the button press. Use flags or conditions triggered by the button to break or exit the loop immediately when pressed.</p>
]]></description><link>https://community.m5stack.com/post/28963</link><guid isPermaLink="true">https://community.m5stack.com/post/28963</guid><dc:creator><![CDATA[peolsolutions]]></dc:creator><pubDate>Fri, 25 Apr 2025 07:00:10 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with button input during loop. (interupt loop) on Thu, 27 Mar 2025 00:33:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/shiva" aria-label="Profile: shiva">@<bdi>shiva</bdi></a> said in <a href="/post/28655">Problem with button input during loop. (interupt loop)</a>:</p>
<blockquote>
<p dir="auto">Hello,</p>
<p dir="auto">I have developed a productivity timer application and am encountering two issues related to interrupting a loop that includes a sleep operation.</p>
<p dir="auto">Interrupt Timing: Currently, to interrupt the loop using a button press, the button must be triggered at the precise moment the event occurs within the loop. This makes it very difficult to reliably interrupt the loop as intended.<br />
Label Update After Interruption: When the loop is successfully paused, a display label (label 0) still updates once more with a lower value before halting, which is unintended.<br />
Could you please advise how I might improve the code to:</p>
<p dir="auto">Allow the loop to be interrupted at any time, rather than requiring precise timing, and<br />
Prevent the label from updating after the interruption is triggered?<br />
Thank you in advance for your assistance.</p>
<p dir="auto">Here is a link to my projectL <a href="https://uiflow2.m5stack.com/?pkey=afd1587cf202443388b62587e6c3744e" target="_blank" rel="noopener noreferrer nofollow ugc">https://uiflow2.m5stack.com/?pkey=afd1587cf202443388b62587e6c3744e</a></p>
</blockquote>
<p dir="auto">Thank you, this is what I am looking for. Do you have a link to the documentation for Timer? I want to create a countdown timer.</p>
]]></description><link>https://community.m5stack.com/post/28675</link><guid isPermaLink="true">https://community.m5stack.com/post/28675</guid><dc:creator><![CDATA[shiva]]></dc:creator><pubDate>Thu, 27 Mar 2025 00:33:08 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with button input during loop. (interupt loop) on Wed, 26 Mar 2025 19:45:20 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/shiva" aria-label="Profile: shiva">@<bdi>shiva</bdi></a></p>
<p dir="auto">please have a look in Project Zone example: <em>M5StickCPlus2_UseTimerToCountSeconds_UIFlow2.2.4</em></p>
<p dir="auto">It shows how to use a timer (instead of sleep) to count. Using a timer makes sure a button press is honored all the time.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/28674</link><guid isPermaLink="true">https://community.m5stack.com/post/28674</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Wed, 26 Mar 2025 19:45:20 GMT</pubDate></item></channel></rss>