Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Adafruit_BBIO.GPIO as GPIO
- import time
- GPIO.setup("P9_21", GPIO.OUT)
- GPIO.setup("P9_22", GPIO.OUT)
- m1a = GPIO.output("P9_21", GPIO.HIGH)
- m1b = GPIO.output("P9_22", GPIO.HIGH)
- while (True):
- try:
- for motor in range (0, 101, 1): #starts at 0, steps up to 101 in 1 steps
- m1a = ("P9_21")
- time.sleep(3)
- print(motor)
- for motor in range (100, -1, -1):
- m1b = ("P9_22")
- time.sleep(3)
- print(motor)
- except(KeyboardInterrupt):
- #And final cleanup
- print "You have just ended your camp trip!"
- GPIO.cleanup()
- quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement