Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 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(11)
  16. print("set_wheels")
  17. robot.sleep(0.5)
  18. listmove = robot.get_line_sensors()
  19. print(robot.get_line_sensors)
  20. print("idu nahuy prjamo")
  21. else:
  22. if listmove[0] < 255 or listmove[1] < 255:
  23. robot.set_left_wheel_speed(-11)
  24. robot.set_right_wheel_speed(11)
  25. robot.sleep(0.5)
  26. listmove = robot.get_line_sensors()
  27. print(robot.get_line_sensors)
  28. print("levo suka")
  29. elif listmove[3] < 255 or listmove[4] < 255:
  30. robot.set_right_wheel_speed(11)
  31. robot.set_left_wheel_speed(-11)
  32. robot.sleep(0.5)
  33. listmove = robot.get_line_sensors()
  34. print(robot.get_line_sensors)
  35. print("sosu pravo")
  36. else:
  37. robot.get_rotation()
  38. robot.sleep(0.5)
  39. listmove = robot.get_line_sensors()
  40. print("nazad sooqa")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement