Exemple #1
0
StepCount = StepCount2
# Start main loop
try:
	while 1==1:
		for pin in range(0,4):
			xpin = StepPins[pin]
			if Seq[StepCounter][pin]!=0:
				print " Step %i Enable %i" %(StepCounter,xpin)
				GPIO.output(xpin, True)
			else:
				GPIO.output(xpin, False)
		StepCounter += 1

	# If we reach end of the sequence
	# Start again
		if (StepCounter == StepCount):
			StepCounter = 0
		if (StepCounter < 0):
			StepCounter = StepCount

		# Wait before moving on
		time.sleep(WaitTime)
except:
	GPIO.cleanup();
finally: # cleaning up and setting pins to low again (motors can get hot if you want)
	GPIO.cleanup();
	for pin in StepPins:
		GPIO.etup(pin, GPIO.OUT)
		GPIO.output(pin, False)