<div dir="auto">The number of interruptions from other things the Pico is processing will cause the variations you are seeing. This is completely normal, and a consequence of pretending to be able to do many things all at the same time.<div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">Neil</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 27 May 2023, 02:37 Rhys Sage via Swlug, <<a href="mailto:swlug@mailman.lug.org.uk">swlug@mailman.lug.org.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I probably shouldn't be trying this after a 12 hour workday but...<br>
<br>
I put a short bit of code into the Pi Pico in Python and get different results each time. This is very curious...<br>
<br>
#test counter versus counting<br>
import time<br>
Min = 0<br>
Max = 100<br>
Tix = 0<br>
tim1 = time.ticks_us()<br>
for x in range(Min, Max):<br>
Tix += 1<br>
tim2 = time.ticks_us()<br>
print(tim2 - tim1)<br>
print(Tix)<br>
<br>
Actual output...<br>
>>> %Run -c $EDITOR_CONTENT<br>
1185<br>
100<br>
>>> %Run -c $EDITOR_CONTENT<br>
1064<br>
100<br>
>>> %Run -c $EDITOR_CONTENT<br>
1069<br>
100<br>
>>> %Run -c $EDITOR_CONTENT<br>
1054<br>
100<br>
>>> %Run -c $EDITOR_CONTENT<br>
1053<br>
100<br>
>>> %Run -c $EDITOR_CONTENT<br>
1054<br>
100<br>
<br>
I would have expected the top value to be the same down the list. <br>
<br>
Rhys Sage<br>
<br>
-- <br>
Swlug mailing list<br>
<a href="mailto:Swlug@mailman.lug.org.uk" target="_blank" rel="noreferrer">Swlug@mailman.lug.org.uk</a><br>
<a href="https://mailman.lug.org.uk/mailman/listinfo/swlug" rel="noreferrer noreferrer" target="_blank">https://mailman.lug.org.uk/mailman/listinfo/swlug</a><br>
</blockquote></div>