Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. """Kekich"""
  2. from PiBot import PiBot
  3. robot = PiBot()
  4. '''[0] - left left
  5. [1] - left
  6. [2] - middle left
  7. [3] - right
  8. [4] - right right
  9. [5] - middle right'''
  10.  
  11.  
  12. listmove = robot.get_line_sensors()
  13. while True:
  14. if listmove[2] < 255 or listmove[5] < 255:
  15. robot.set_wheels_speed(10)
  16. print("set_wheels")
  17. robot.sleep(0.5)
  18. listmove = robot.get_line_sensors()
  19. print("idu nahuy prjamo")
  20. else:
  21. if listmove[0] < 255 or listmove[1] < 255:
  22. robot.set_left_wheel_speed(-10)
  23. robot.set_right_wheel_speed(10)
  24. robot.sleep(0.5)
  25. listmove = robot.get_line_sensors()
  26. print("levo suka")
  27. elif listmove[3] < 255 or listmove[4] < 255:
  28. robot.set_right_wheel_speed(10)
  29. robot.set_left_wheel_speed(-10)
  30. robot.sleep(0.5)
  31. listmove = robot.get_line_sensors()
  32. print("sosu pravo")
  33. else:
  34. robot.get_rotation()
  35. robot.sleep(0.5)
  36. listmove = robot.get_line_sensors()
  37. print("nazad sooqa")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement