#!/usr/bin/python # Terry Sturtevant, May 10, 2017 import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) stepper_pins=[13,16,26,21] GPIO.setup(stepper_pins,GPIO.OUT) stepper_sequence=[] stepper_sequence.append([GPIO.HIGH, GPIO.LOW, GPIO.LOW,GPIO.LOW]) stepper_sequence.append([GPIO.HIGH, GPIO.HIGH, GPIO.LOW,GPIO.LOW]) stepper_sequence.append([GPIO.LOW, GPIO.HIGH, GPIO.LOW,GPIO.LOW]) stepper_sequence.append([GPIO.LOW, GPIO.HIGH, GPIO.HIGH,GPIO.LOW]) stepper_sequence.append([GPIO.LOW, GPIO.LOW, GPIO.HIGH,GPIO.LOW]) stepper_sequence.append([GPIO.LOW, GPIO.LOW, GPIO.HIGH,GPIO.HIGH]) stepper_sequence.append([GPIO.LOW, GPIO.LOW, GPIO.LOW,GPIO.HIGH]) stepper_sequence.append([GPIO.HIGH, GPIO.LOW, GPIO.LOW,GPIO.HIGH]) try: while True: # for row in reversed (stepper_sequence): for row in stepper_sequence: GPIO.output(stepper_pins,row) time.sleep(0.01) except KeyboardInterrupt: pass GPIO.cleanup()
Wilfrid Laurier University
© 2019 Wilfrid Laurier University