I have a stepper 288yj-48 and I want it to stop 36 times while completing a 360 degrees revolution. For each of the 36 stops, I need it to pause for 10 seconds before moving to the next position.
Here below the code I’m starting with. You'll see “for in range(14)” where 14 represents 1 of the 36 steps I need the stepper to stop at, but I'm not sure if this is the right way to go.
Any suggestion? Thanks
Here you can find the tutorial I took the code from: https://medium.com/@Keithweaver_/controlling-stepper-motors-using-python-with-a-raspberry-pi-b3fbd482f886
import time
GPIO.setmode(GPIO.BOARD)
control_pins = [7,11,13,15]
for pin in control_pins:
GPIO.setup(pin, GPIO.OUT)
GPIO.output(pin, 0)
halfstep_seq = [
[1,0,0,0],
[1,1,0,0],
[0,1,0,0],
[0,1,1,0],
[0,0,1,0],
[0,0,1,1],
[0,0,0,1],
[1,0,0,1]
]
for i in range(14):
for halfstep in range(8):
for pin in range(4):
GPIO.output(control_pins[pin], halfstep_seq[halfstep][pin])
time.sleep(0.001)
GPIO.cleanup()
tell one of the steppers to stop
... why do you need to "tell" the stepper anything? ... just stop sending a step command