Advertisement
silver2row

MBC IIII

Feb 3rd, 2020
495
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.17 KB | None | 0 0
  1. from MotorBridgeI import MotorBridgeCape
  2. from time import sleep
  3.  
  4. motor = MotorBridgeCape()
  5. motor.ServoInit(2, 50)
  6. motor.ServoInit(6, 50)
  7. mylist = [0]
  8.  
  9. def servo(moveOne):
  10.     for angle in 0, 45, 90, 135, 180, 135, 90, 45, 0:
  11.         sleep(0.4)
  12.         motor.ServoMoveAngle(2, angle)
  13.         motor.ServoMoveAngle(6, angle)
  14.  
  15. def inlineOne(MoveItOne):
  16.     for angle in 10, 20, 30, 40, 50, 60, 70, 80, 990, 100, 110, 120, 130, 140, 150, 160, 170, 180:
  17.         sleep(0.4)
  18.         motor.ServoMoveAngle(2, angle)
  19.         motor.ServoMoveAngle(6, angle)
  20.  
  21. def inlineTwo(MoveItTwo):
  22.     for angle in 180, 150, 120, 90, 60, 30, 0:
  23.         sleep(0.4)
  24.         motor.ServoMoveAngle(2, angle)
  25.         motor.ServoMoveAngle(6, angle)
  26.  
  27. def inlineServo():
  28.     if mylist == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:
  29.         sleep(0.4)
  30.         motor.ServoMoveAngle(2, mylist)
  31.         motor.ServoMoveAngle(6, mylist)
  32.         print("The servos are going to move from degree 1 to 10: ", mylist)
  33.     else:
  34.         sleep(0.4)
  35.         print("You are busted!", mylist)
  36.  
  37.         return
  38.  
  39. inlineServo()
  40. mylist = [10, 20, 30, 40, 50, 60, 70, 80]
  41. print("Outside of the function values are: ", mylist)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement