Answer the question
In order to leave comments, you need to log in
How to execute loops in parallel in python(2.7)?
I'm trying to learn python. I broke my whole head ... I have python 2.7 on the raspberry pi 3, I'm trying to run two stepper motors at the same time.
There is such a design:
step_timeout = 0.0000000001
impulse_timeout =0.00075
for i in range(0,850):
GPIO.output(19, GPIO.HIGH)
time.sleep(impulse_timeout)
GPIO.output(19, GPIO.LOW)
time.sleep(step_timeout)
GPIO.output(13, GPIO.HIGH)
time.sleep(impulse_timeout)
GPIO.output(13, GPIO.LOW)
time.sleep(step_timeout)
GPIO.output(6, GPIO.HIGH)
time.sleep(impulse_timeout)
GPIO.output(6, GPIO.LOW)
time.sleep(step_timeout)
GPIO.output(5, GPIO.HIGH)
time.sleep(impulse_timeout)
GPIO.output(5, GPIO.LOW)
time.sleep(step_timeout)
step_timeout = 0.002
impulse_timeout =0.001
for i in range(0,800):
GPIO.output(12, GPIO.HIGH)
time.sleep(impulse_timeout)
GPIO.output(12, GPIO.LOW)
time.sleep(step_timeout)
GPIO.output(16, GPIO.HIGH)
time.sleep(impulse_timeout)
GPIO.output(16, GPIO.LOW)
time.sleep(step_timeout)
GPIO.output(20, GPIO.HIGH)
time.sleep(impulse_timeout)
GPIO.output(20, GPIO.LOW)
time.sleep(step_timeout)
GPIO.output(21, GPIO.HIGH)
time.sleep(impulse_timeout)
GPIO.output(21, GPIO.LOW)
time.sleep(step_timeout)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question