Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
waking up every second
#1
if you write some code to wake up every second, it could accumulate the system delays and quickly be way off. what have you done to deal with this? back in my days of C programming, my code would calculate how long to wait, such as in nanoseconds. doing so in Python seems to work. is there a better way to do this in Python?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
You should use event processing to create an event (interrupt) when something (whatever you decide) triggers.
I hate to point to stack overflow, but there are two posts there of interest:
https://stackoverflow.com/questions/1092...-in-python
https://stackoverflow.com/a/1096614
Reply
#3
the publish-subscribe pattern make sense and seems right. now to look through the choices and make sure they have reliable time-cycle publishers. time-cycle could be complex because so many cycle periods are possible, such as "every 35 seconds".
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#4
I always felt that all computer motherboards should have three items available for programming use:
An A/D converter, A D/A converter, and a good counter timer independent of main clock.
Reply
#5
and the counter-timer should have a way to set a level-state interrupt.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Forum Jump:

User Panel Messages

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