Python Forum
Running loop at specific frequency
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running loop at specific frequency
#4
time.perf_counter() is the current time in seconds, with the decimal part out to the accuracy of the system
start is the time everything started
division is which "tick" you are on - 60 seconds times 30 ticks per second = 1800 ticks So, division/30 is the amount to add to start to get the time at which the "gate opens"
BTW - can eliminate the end_time line - that was in there when I was going a different path.
Reply


Messages In This Thread
Running loop at specific frequency - by mdsousa - Apr-19-2021, 05:55 PM
RE: Running loop at specific frequency - by mdsousa - Apr-20-2021, 04:45 PM
RE: Running loop at specific frequency - by jefsummers - Apr-21-2021, 11:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  help RuntimeError: no running event loop marpaslight 5 8,926 Oct-18-2022, 10:04 PM
Last Post: marpaslight
  FFT - frequency shifted frohr 0 1,223 Jul-23-2022, 05:17 PM
Last Post: frohr
  How to save specific variable in for loop in to the database? ilknurg 1 1,959 Mar-09-2022, 10:32 PM
Last Post: cubangt
  bleak library RuntimeError: This event loop is already running alice93 3 7,187 Sep-30-2021, 08:06 AM
Last Post: alice93
  loop running indefinitely shantanu97 6 4,068 Sep-29-2021, 08:03 PM
Last Post: deanhystad
  Running A Loop Until You See A Particular Result knight2000 6 35,200 Sep-04-2021, 08:55 AM
Last Post: knight2000
  RuntimeError: This event loop is already running newbie2019 2 8,099 Sep-30-2020, 06:59 PM
Last Post: forest44
  Running function from parent module which has a loop in it. ta2909i 1 3,643 Nov-18-2019, 07:04 PM
Last Post: Gribouillis
  Delete specific lines contain specific words mannyi 2 5,205 Nov-04-2019, 04:50 PM
Last Post: mannyi
  loop through range until reach size and exclude specific symbol pino88 3 3,418 Sep-23-2019, 02:32 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

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