repository to manage all files related to the makeathon farm bot project (Software + Documentation).
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

drive_arm.py 679B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env python3
  2. """
  3. created by waldhauser
  4. This file contains the programm to drive the arm back to middle
  5. This file is needed for the color code drive operation
  6. The plant where the robot is has to be passed as argument
  7. """
  8. from ev3dev2.motor import Motor, OUTPUT_B, OUTPUT_C, SpeedPercent
  9. import sys
  10. motorUpDown = Motor(OUTPUT_C)
  11. motorLeftRight = Motor(OUTPUT_B)
  12. plantID = int(sys.argv[1])
  13. # Set direction of arm rotation back to middle
  14. if plantID % 2 == 0:
  15. leftRight = 50 # rotating right
  16. else:
  17. leftRight = -50 # rotating left
  18. motorUpDown.on_for_seconds(SpeedPercent(-50), seconds=2.8)
  19. motorLeftRight.on_for_degrees(SpeedPercent(leftRight), 400)