[Swlug] Interesting variations
Neil Greenwood
neil.greenwood.lug at gmail.com
Sat May 27 06:21:59 UTC 2023
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.
Neil
On Sat, 27 May 2023, 02:37 Rhys Sage via Swlug, <swlug at mailman.lug.org.uk>
wrote:
> I probably shouldn't be trying this after a 12 hour workday but...
>
> I put a short bit of code into the Pi Pico in Python and get different
> results each time. This is very curious...
>
> #test counter versus counting
> import time
> Min = 0
> Max = 100
> Tix = 0
> tim1 = time.ticks_us()
> for x in range(Min, Max):
> Tix += 1
> tim2 = time.ticks_us()
> print(tim2 - tim1)
> print(Tix)
>
> Actual output...
> >>> %Run -c $EDITOR_CONTENT
> 1185
> 100
> >>> %Run -c $EDITOR_CONTENT
> 1064
> 100
> >>> %Run -c $EDITOR_CONTENT
> 1069
> 100
> >>> %Run -c $EDITOR_CONTENT
> 1054
> 100
> >>> %Run -c $EDITOR_CONTENT
> 1053
> 100
> >>> %Run -c $EDITOR_CONTENT
> 1054
> 100
>
> I would have expected the top value to be the same down the list.
>
> Rhys Sage
>
> --
> Swlug mailing list
> Swlug at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/swlug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/swlug/attachments/20230527/31ac7056/attachment.htm>
More information about the Swlug
mailing list