Guest User

Untitled

a guest
Feb 12th, 2016
141
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def setStep(w1, w2, w3, w4):
  2. GPIO.output(coil_A_1_pin, w1)
  3. GPIO.output(coil_A_2_pin, w2)
  4. GPIO.output(coil_B_1_pin, w3)
  5. GPIO.output(coil_B_2_pin, w4)
  6.  
  7. GPIO.output(coil_C_1_pin, w1)
  8. GPIO.output(coil_C_2_pin, w2)
  9. GPIO.output(coil_D_1_pin, w3)
  10. GPIO.output(coil_D_2_pin, w4)
  11.  
  12. def forward x(delay, steps):
  13. for i in range(steps):
  14. for j in range(StepCount):
  15. setStep(Seq[j][0], Seq[j][1], Seq[j][2], Seq[j][3])
  16. time.sleep(delay)
  17.  
  18. def backwards x(delay, steps):
  19. for i in range(steps):
  20. for j in reversed(range(StepCount)):
  21. setStep(Seq[j][0], Seq[j][1], Seq[j][2], Seq[j][3])
  22. time.sleep(delay)
  23.  
  24. def forward y(delay, steps):
  25. for i in range(steps):
  26. for j in range(StepCount):
  27. setStep(Seq[j][0], Seq[j][1], Seq[j][2], Seq[j][3])
  28. time.sleep(delay)
  29.  
  30. def backwards y(delay, steps):
  31. for i in range(steps):
  32. for j in reversed(range(StepCount)):
  33. setStep(Seq[j][0], Seq[j][1], Seq[j][2], Seq[j][3])
  34. time.sleep(delay)
RAW Paste Data