How to delay until a next increment of time occurs ?

R.Wieser address at not.available
Wed Nov 13 09:02:53 EST 2019


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