How to delay until a next increment of time occurs ?

Dave Cinege dave at cinege.com
Wed Nov 13 21:42:46 EST 2019


Can you expand on what you are trying to accomplish with this?
It seems a small C program or library you interface python too is a 
better solution. With that said, as others mentioned you might need a 
real time OS or micro controller if this needs to be dead on timing.

Dave

On 2019/11/13 09:02, R.Wieser wrote:
> Hello all,
> 
> I'm writing some code to toggle a pin on a Raspberry Pi, and would like to
> have that happen at (multiples of) 300 uSec increments.
> 
> I tried time.sleep(), but that one disregards the time after the last one
> ends and the new one is started.  In other words, all the time spend in code
> (or being interrupted by another thread!) between the end of the previous
> and the start of the current sleep throws the whole repetitive timing off.
> 
> So, I'm looking for a method that will allow me to wait for a "last time
> plus increment".  Is there one with the properties of sleep() (not just
> burning processor cycles way, blocking all threads), but referencing a
> previous time.
> 
> Regards,
> Rudy Wieser
> 
> 


More information about the Python-list mailing list