How to generate precise pulses with python?
from threading import Thread
import time
def runA():
while True:
print "a"
sendSignal(1)
time.sleep(0.0001)
sendSignal(0)
time.sleep(0.005)
if __name__ == "__main__":
t1 = Thread(target = runA)
t1.setDaemon(True)
t1.start()
while True:
sleep(10)
time management in python is not precise. specially to create multi-threaded PWM generators (assuming each thread to send data at specific rate) . is there any better way to generate pulses? precise ones!
[The solution is language-independent]