<?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[M5Paper V1.1 - Simple loop stops counting]]></title><description><![CDATA[<p dir="auto">I created a simple loop to draw several squares (touch buttons) with text. However, the last square (the second loop) isn't filled with text, and the loop only loops 5 times.<br />
What am I missing?</p>
<p dir="auto">Note:<br />
UIFlow 1.0<br />
I am using the screen horizontally.<br />
960 pixels total (Y)<br />
6 buttons, 125 pixels<br />
30 pixels spacing</p>
<p dir="auto"><img src="/assets/uploads/files/1768678020316-uiflow_block_1768590699927.png" alt="uiflow_block_1768590699927.png" class=" img-fluid img-markdown" /></p>
<pre><code>from m5stack import *
from m5ui import *
from uiflow import *


setScreenColor(15)


Ynext = None
Counter = None




from numbers import Number


def upRange(start, stop, step):
  while start &lt;= stop:
    yield start
    start += abs(step)

def downRange(start, stop, step):
  while start &gt;= stop:
    yield start
    start -= abs(step)



Ynext = 0
Counter = 0
Ynext_end = float(960 - (125 + 30))
Ynext_inc = float(125 + 30)
for Ynext in (30 &lt;= Ynext_end) and upRange(30, Ynext_end, Ynext_inc) or downRange(30, Ynext_end, Ynext_inc):
  lcd.rect(380, int(Ynext), 125, 125, color=0)
Ynext_end2 = float(960 - (125 + 30))
Ynext_inc2 = float(125 + 30)
for Ynext in (54 &lt;= Ynext_end2) and upRange(54, Ynext_end2, Ynext_inc2) or downRange(54, Ynext_end2, Ynext_inc2):
  Counter = (Counter if isinstance(Counter, Number) else 0) + 1
  lcd.font(lcd.FONT_DejaVu40)
  lcd.print(((str('AC') + str(Counter))), 470, int(Ynext), 0, rotate=90)
lcd.show()
</code></pre>
]]></description><link>https://community.m5stack.com/topic/8028/m5paper-v1-1-simple-loop-stops-counting</link><generator>RSS for Node</generator><lastBuildDate>Sun, 08 Mar 2026 11:21:39 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/8028.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 17 Jan 2026 19:32:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5Paper V1.1 - Simple loop stops counting on Tue, 20 Jan 2026 08:50:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/5596">@robski</a> Adding 24 is exactly the same as my solution, 30+24=54 and changing the "to" in the loop block will change the python end2 value. It should then work as expected.</p>
]]></description><link>https://community.m5stack.com/post/30493</link><guid isPermaLink="true">https://community.m5stack.com/post/30493</guid><dc:creator><![CDATA[veryalien]]></dc:creator><pubDate>Tue, 20 Jan 2026 08:50:16 GMT</pubDate></item><item><title><![CDATA[Reply to M5Paper V1.1 - Simple loop stops counting on Mon, 19 Jan 2026 20:05:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/24145">@RIDDSprojects</a> your Ynext end2 (805) must be diff to Ynext end (805)   ...  add 24?</p>
]]></description><link>https://community.m5stack.com/post/30492</link><guid isPermaLink="true">https://community.m5stack.com/post/30492</guid><dc:creator><![CDATA[robski]]></dc:creator><pubDate>Mon, 19 Jan 2026 20:05:43 GMT</pubDate></item><item><title><![CDATA[Reply to M5Paper V1.1 - Simple loop stops counting on Mon, 19 Jan 2026 15:41:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/24145">@RIDDSprojects</a> I think you need to change your second loop to loop to a value of 960 - (125 + <strong>54</strong>)) not 30. I think, without trying it myself, the second loop ends too soon because you are starting at offset 54, not at 30.</p>
]]></description><link>https://community.m5stack.com/post/30490</link><guid isPermaLink="true">https://community.m5stack.com/post/30490</guid><dc:creator><![CDATA[veryalien]]></dc:creator><pubDate>Mon, 19 Jan 2026 15:41:05 GMT</pubDate></item></channel></rss>