Advertisement
Guest User

straight_and_revers_fixed

a guest
Mar 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. void straight_and_reverse(int target_distance_fwd, int target_distance_bwd)
  2. {
  3. if (checkDistanceMet(target_distance) & car_reversed == 0)
  4. {
  5. if (time_interval1*check_intervals_passed >= 1000)
  6. {
  7. motor.change_direction();
  8. motor1.change_direction();
  9. car_reverse = 1;
  10. }
  11. else
  12. {
  13. check_intervals_passed++;
  14. motor.stopMotor();
  15. motor1.stopMotor();
  16. }
  17. }
  18. else if (checkDistanceMet(target_distance_bwd) & car_reversed == 1)
  19. {
  20. motor.stopMotor();
  21. motor1.stopMotor();
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement