Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO
- import time
- GPIO.setmode(GPIO.BCM)
- pin1 = 24
- pin2 = 25
- pin3 = 8
- pin4 = 7
- GPIO.setup(pin1, GPIO.OUT)
- GPIO.setup(pin2, GPIO.OUT)
- GPIO.setup(pin3, GPIO.OUT)
- GPIO.setup(pin4, GPIO.OUT)
- def setStep(w1, w2, w3, w4):
- GPIO.output(pin1, w1)
- GPIO.output(pin2, w2)
- GPIO.output(pin3, w3)
- GPIO.output(pin4, w4)
- while True:
- delay = 0.002
- setStep(1, 1, 0, 0)
- time.sleep(delay)
- setStep(0, 1, 1, 0)
- time.sleep(delay)
- setStep(0, 0, 1, 1)
- time.sleep(delay)
- setStep(1, 0, 0, 1)
- time.sleep(delay)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement