Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Timing of a while loop
#5
Yeah sorry about the confusing question, I tried my best to articulate it.

I’ll go through the above code this afternoon.

I was thinking this might work for me as well:

function_one():
   if reset == true:
      time.sleep(30)
      a = b

   if a = b:
      Do_something
Function one is looping on a main timer every 30 sec, so the code is being run through on the 30 sec, every minute. If I make the flag called “reset”. No matter where we are in the 30 seconds, the function_one code will always wait for the start of the 30 sec, then we sleep for the flag, then a=b, then function_one runs again and a=b so do_something is executed.

I think that might serve my purpose. Sorry I’m super amateur at coding.
Reply


Messages In This Thread
Timing of a while loop - by stylingpat - Mar-30-2021, 09:23 PM
RE: Timing of a while loop - by deanhystad - Mar-30-2021, 11:03 PM
RE: Timing of a while loop - by BashBedlam - Mar-31-2021, 12:49 AM
RE: Timing of a while loop - by deanhystad - Mar-31-2021, 03:55 AM
RE: Timing of a while loop - by stylingpat - Mar-31-2021, 10:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Timing actions with Python dangermaus33 0 1,058 Apr-19-2022, 10:08 PM
Last Post: dangermaus33
  Inconsistent counting / timing with threading rantwhy 1 1,822 Nov-24-2021, 04:04 AM
Last Post: deanhystad
  Synchronization/Timing Problem quest 5 3,129 Mar-31-2021, 10:26 PM
Last Post: quest
  Assigning Data from one column to another with different associated timing interval alexafshari 1 2,005 Apr-30-2020, 03:59 PM
Last Post: pyzyx3qwerty
  Frequency and timing of psycopg2 commits acecase 0 2,327 Nov-01-2019, 05:50 PM
Last Post: acecase
  Perpetual timing Mark17 3 2,997 Oct-24-2019, 03:46 PM
Last Post: Gribouillis
  Timing input Mark17 2 2,361 Oct-23-2019, 08:25 PM
Last Post: Mark17
  Timing functions with multiprocessing mntfr 3 5,142 Nov-18-2018, 06:00 AM
Last Post: woooee
  GPIO output timing help needed skid 5 4,172 Jan-23-2018, 04:12 PM
Last Post: skid
  change timing on py script kwfreverie 2 3,213 Dec-16-2017, 07:35 PM
Last Post: kwfreverie

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020