Advertisement
Guest User

Untitled

a guest
May 1st, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. import Adafruit_BBIO.GPIO as GPIO
  2. import time
  3.  
  4. GPIO.setup("P9_21", GPIO.OUT)
  5. GPIO.setup("P9_22", GPIO.OUT)
  6.  
  7. m1a = GPIO.output("P9_21", GPIO.HIGH)
  8. m1b = GPIO.output("P9_22", GPIO.HIGH)
  9.  
  10. while (True):
  11.  
  12.         try:
  13.                 for motor in range (0, 101, 1): #starts at 0, steps up to 101 in 1 steps
  14.                     m1a = ("P9_21")
  15.                     time.sleep(3)
  16.                     print(motor)
  17.                 for motor in range (100, -1, -1):
  18.                     m1b = ("P9_22")
  19.                     time.sleep(3)
  20.                     print(motor)
  21.  
  22.         except(KeyboardInterrupt):
  23.  
  24.                 #And final cleanup
  25.                 print "You have just ended your camp trip!"
  26.                 GPIO.cleanup()
  27.                 quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement