Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import RPi.GPIO as GPIO
- GPIO.setmode(GPIO.BOARD)
- GPIO.setwarnings(FALSE)
- A=7
- B=11
- C=13
- D=15
- sleep_time = 0.01
- def GPIO_SETUP(a, b, c, d):
- GPIO.output(A, a)
- GPIO.output(B, b)
- GPIO.output(C, c)
- GPIO.output(D, d)
- time.sleep(sleep_time)
- def RIGHT_TURN(deg, step):
- GPIO_SETUP(0, 0, 0, 0)
- if step == "full":
- print"Fullstepping", deg, "Degrees"
- if step == "half":
- print"Halfstepping", deg, "Degrees"
- while deg > 0.0:
- if step == "half":
- GPIO_SETUP(1,0,0,1)
- GPIO_SETUP(1,0,0,0)
- GPIO_SETUP(1,1,0,0)
- GPIO_SETUP(0,1,0,0)
- GPIO_SETUP(0,1,1,0)
- GPIO_SETUP(0,0,1,0)
- GPIO_SETUP(0,0,1,1)
- GPIO_SETUP(0,0,0,1)
- print "Degree left", deg
- deg = deg -1.0
- if step == "full":
- GPIO_SETUP(1,0,0,0)
- GPIO_SETUP(0,1,0,0)
- GPIO_SETUP(0,0,1,0)
- GPIO_SETUP(0,0,0,1)
- print "Degree left", deg
- deg = deg -1.0
- RIGHT_TURN(90, "full")
- GPIO.cleanup()
Add Comment
Please, Sign In to add comment