top of page

Stepper Motor Half Step


import RPi.GPIO as GPIO

import time

GPIO.setmode(GPIO.BOARD)

control_pins = [11,15,16,18]

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]

]

StepCount = len(halfstep_seq)

print("Number setps in sequence:{}".format(StepCount))

for i in range(1024):

for halfstep in range(8):

for pin in range(4):

xpin = control_pins[pin]

#print("Enable GPIO: {}".format(xpin))

GPIO.output(control_pins[pin], halfstep_seq[halfstep][pin])

time.sleep(0.01)

GPIO.cleanup()


Featured Posts
Recent Posts
Archive
Search By Tags
No tags yet.
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page