Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8042

Python • Re: Change sleep duration of a loop without restarting it (use a variable from an imported script?)

$
0
0
With very long durations, I would suggest to divide the sleep time and check more often if the time has changed instead of waiting for the next iteration
Any particular reason? I don't see any benefit. Low overhead.

This was just an example
By dividing the sleep times, you obtain that the values get checked for changes a lot faster, and you can have a confirmation by printing or blinking a led or whatever, that the new values have kicked in. I probably couldn't stand having to wait up to 12 hours to see if my settings have changed :lol:
I don't think that overhead is a problem here, as the system is only sleeping, and the commands are minimal.

Statistics: Posted by kheylen25 — Sun Jan 26, 2025 8:09 am



Viewing all articles
Browse latest Browse all 8042

Trending Articles